Compare commits

...

699 Commits

Author SHA1 Message Date
Simon Larsen
71a0edb7dd ```text
refactor: Update MonitorReport API endpoint route

This commit updates the API endpoint route for the MonitorReport model. The route is changed from "/status-page" to "/monitor-report" in the MonitorReport.ts file. This change ensures consistency and clarity in the API routes, aligning them with the model name.
2024-07-23 10:42:20 -06:00
Simon Larsen
a53b24ed05 refactor: Add Monitor Reports to SideMenu
This commit adds the "Monitor Reports" option to the SideMenu in the Monitor page. It includes the necessary code changes in the MonitorReports.tsx, MonitorReport/View/Index.tsx, MonitorReport/View/Delete.tsx, MonitorReport/View/Settings.tsx, and SideMenu.tsx files. The new option allows users to access and manage monitor reports directly from the SideMenu, improving the navigation and usability of the Monitor page.
2024-07-23 10:25:33 -06:00
Simon Larsen
9f8764d741 refactor: Add canReadOnRelationQuery property to TelemetryService's serviceColor
This commit adds the `canReadOnRelationQuery` property to the `serviceColor` field in the `TelemetryService` model. The `canReadOnRelationQuery` property allows for reading the `serviceColor` field when querying related data. This change enhances the functionality and flexibility of the `TelemetryService` model when working with related data.
2024-07-23 09:50:15 -06:00
Simon Larsen
9ce44cc416 refactor: Update BlogTitleAndDescription styling for better readability
This commit updates the styling of the BlogTitleAndDescription component in the BlogTitleAndDescription.ejs file. The font size, font weight, and line height of the title and description elements are adjusted to improve readability and visual hierarchy. This change enhances the overall user experience when viewing blog titles and descriptions on the home page.
2024-07-22 20:09:27 -06:00
Simon Larsen
f5f542cae6 refactor: Remove unnecessary whitespace in StatusAPI 2024-07-22 15:29:26 -06:00
Simon Larsen
de4eea4d24 refactor: Round metric values to integers in MetricView component 2024-07-22 15:24:08 -06:00
Simon Larsen
104535b723 ```text
refactor: Round metric values to integers in MetricView component

This commit modifies the MetricView component in the MetricView.tsx file. It adds logic to round the metric values to integers using the Math.round() function. This change improves the accuracy and readability of the displayed metric values.
2024-07-22 15:09:31 -06:00
Simon Larsen
6f5dfceb34 refactor: Enable real-time updates in LogsViewer components
This commit enables real-time updates in the LogsViewer components by setting the `enableRealtime` prop to `true` in the `Logs.tsx` and `Index.tsx` files. Previously, real-time updates were disabled (`enableRealtime` set to `false`), but this change allows for immediate updates of logs when new data is available. This enhancement improves the usability and responsiveness of the LogsViewer feature.
2024-07-22 14:47:01 -06:00
Simon Larsen
1ec61a473a refactor: Update LogItem component to display service name and color
This commit updates the LogItem component in the LogItem.tsx file. It adds functionality to display the service name and color based on the serviceId provided. The serviceMap dictionary is used to retrieve the service name and color, improving the readability and usability of the component. This change enhances the overall quality and user experience of the LogsViewer feature.
2024-07-22 14:33:18 -06:00
Simon Larsen
abf4faade7 refactor: Update TraceTable component to use React hooks and improve performance
This commit updates the TraceTable component in the TraceTable.tsx file. The component is refactored to use React hooks instead of class components, resulting in cleaner and more concise code. Additionally, the update improves the performance of the component by removing unused code and optimizing rendering. These changes enhance the overall quality and maintainability of the TraceTable component.
2024-07-22 13:50:04 -06:00
Simon Larsen
6a9ee5ba75 refactor: Add jsonKeys property to Filter interfaces
This commit adds the `jsonKeys` property to the `Filter` interface in two different files: `Filter.ts` and `ModelFilter/Filter.ts`. The `jsonKeys` property is an array of strings and is used to specify the JSON keys associated with a filter. This addition allows for more flexibility and customization when working with filters in the application.
2024-07-22 13:48:33 -06:00
Simon Larsen
b696e52145 refactor: Update SpanStatusElement component to handle SpanStatus
This commit updates the SpanStatusElement component to handle the new SpanStatus type. The title prop of the component is modified to accept a SpanStatus value in addition to a string. This change allows for more accurate and descriptive rendering of the span status in the TraceExplorer and TraceTable components. The update improves the overall consistency and usability of the application when displaying span status information.
2024-07-21 17:23:00 -06:00
Simon Larsen
8af8eb34ad refactor: Update TelemetryLayout component and add TraceTable
This commit updates the TelemetryLayout component to improve performance and readability. Unused code is removed, including imports, variables, and functions that are no longer needed. The component is also refactored to use React hooks instead of class components, resulting in cleaner and more concise code.

Additionally, a new TraceTable component is added, which replaces the TelemetryServiceTable component in the Telemetry/Traces.tsx file. The TraceTable component provides enhanced functionality for displaying and filtering trace data.

These changes enhance the overall quality, maintainability, and functionality of the TelemetryLayout component and improve the user experience when viewing telemetry data.
2024-07-21 17:10:09 -06:00
Simon Larsen
e600fac4fd refactor: Update TelemetryLayout component and add TraceTable 2024-07-21 17:02:51 -06:00
Simon Larsen
1772953b34 refactor: Update TelemetryLayout component and add TraceTable
This commit updates the TelemetryLayout component to improve performance and readability. Unused code is removed, including imports, variables, and functions that are no longer needed. The component is also refactored to use React hooks instead of class components, resulting in cleaner and more concise code.

Additionally, a new TraceTable component is added, which replaces the TelemetryServiceTable component in the Telemetry/Traces.tsx file. The TraceTable component provides enhanced functionality for displaying and filtering trace data.

These changes enhance the overall quality, maintainability, and functionality of the TelemetryLayout component and improve the user experience when viewing telemetry data.
2024-07-21 15:37:40 -06:00
Simon Larsen
44e3c99da8 refactor: Remove unused code and update TelemetryLayout component 2024-07-21 14:30:45 -06:00
Simon Larsen
5fa0f23689 refactor: Remove unused code and update TelemetryLayout component
This commit removes unused code in the TelemetryLayout component and updates it to improve performance and readability. The unused code includes imports, variables, and functions that are no longer needed. The component is also refactored to use React hooks instead of class components, resulting in cleaner and more concise code. These changes enhance the overall quality and maintainability of the TelemetryLayout component.
2024-07-21 13:09:00 -06:00
Simon Larsen
5a9a53dfea refactor: Add TelemetryAttributeService and update BaseAPIFeatureSet 2024-07-21 10:54:56 -06:00
Simon Larsen
9dae8e1764 refactor: Remove commented out code for empty formula configuration 2024-07-21 10:06:08 -06:00
Simon Larsen
2c8b58c293 refactor: Remove commented out code for empty formula configuration 2024-07-21 10:05:55 -06:00
Simon Larsen
57686c87e3 refactor: Remove commented out code for empty formula configuration 2024-07-21 09:18:03 -06:00
Simon Larsen
51a714f4bd refactor: Add jsonKeys prop to Filter and JSONFilter components
This commit adds the jsonKeys prop to the Filter and JSONFilter components in order to support filtering by JSON keys. The jsonKeys prop is an array of string values that represents the available JSON keys for filtering. This enhancement improves the flexibility and functionality of the filter components, allowing users to filter data based on specific JSON keys.
2024-07-20 09:25:34 -06:00
Simon Larsen
358b785fe0 refactor: Remove TelemetryAttribute model and service
This commit removes the TelemetryAttribute model and service from the codebase. The TelemetryAttribute model and service were no longer needed and were causing unnecessary complexity. Removing them simplifies the codebase and improves maintainability.
2024-07-20 08:08:00 -06:00
Simon Larsen
5ab959cec5 refactor: Add TelemetryAttributeService and update BaseAPIFeatureSet
This commit adds the TelemetryAttributeService to the AnalyticsServices array in the CommonServer/Services/Index.ts file. It also updates the BaseAPIFeatureSet in the App/FeatureSet/BaseAPI/Index.ts file to include a new route for handling telemetry attribute operations. These changes improve the functionality and flexibility of the analytics module, allowing users to work with telemetry attributes effectively.
2024-07-19 18:59:50 -06:00
Simon Larsen
97bb269ccf refactor: Update TelemetryAttribute model and service
This commit updates the TelemetryAttribute model and service to align with the changes made in the AnalyticsModels/TelemetryAttribute.ts file. The model's tableName, singularName, pluralName, and crudApiPath properties have been modified to reflect the new naming convention for telemetry attributes. Additionally, the TelemetryAttributeService has been added to the AnalyticsServices array in the CommonServer/Services/Index.ts file. These changes improve the consistency and functionality of the telemetry attribute module, allowing users to work with telemetry attributes effectively.
2024-07-19 16:57:19 -06:00
Simon Larsen
85c70bbc17 refactor: Add TelemetryAttributeService to AnalyticsServices
This commit adds the TelemetryAttributeService to the AnalyticsServices array in the CommonServer/Services/Index.ts file. By including the TelemetryAttributeService, we ensure that the service is available for handling telemetry attribute-related operations in the analytics module. This enhancement improves the functionality and flexibility of the analytics services, allowing users to work with telemetry attributes effectively.
2024-07-19 16:48:12 -06:00
Simon Larsen
7effd05896 refactor: Update MetricQueryConfig and MetricQuery components
This commit updates the MetricQueryConfig and MetricQuery components to include the metricNames prop. The metricNames prop is an array of string values that represents the available metric names for filtering and querying. This change improves the flexibility and functionality of the components, allowing users to select from a predefined list of metric names.
2024-07-19 15:57:21 -06:00
Simon Larsen
3123b5304d refactor: Update StartAndEndDate component to use boolean type for time interval variables
This commit refactors the StartAndEndDate component to use the boolean type for the time interval variables (is1Hour, is3Hours, is1Day, etc.). This change improves code readability and ensures consistent typing, making it easier to understand and maintain the component.
2024-07-19 15:37:10 -06:00
Simon Larsen
6ea6f94694 getAggregationInterval 2024-07-19 15:25:29 -06:00
Simon Larsen
4b91e598ce refactor: Update StatementGenerator.ts and AnalyticsDatabaseService.ts
The code changes in StatementGenerator.ts and AnalyticsDatabaseService.ts refactor the import statements for the AggregateBy module. The changes ensure consistent formatting and improve code readability.
2024-07-19 14:02:54 -06:00
Simon Larsen
07293006c3 refactor: Update MetricView component to render charts for metric results 2024-07-19 13:58:46 -06:00
Simon Larsen
74857d58d8 refactor: Update MetricView component to render charts for metric results 2024-07-18 18:03:37 -06:00
Simon Larsen
e93b74665b refactor: Remove unused code and update types in AggregateBy.ts, StatementGenerator.ts, and MetricView.tsx 2024-07-18 17:58:26 -06:00
Simon Larsen
3c0eeeb81d refactor: Update ModelAPI to return AggregatedResult in aggregate method 2024-07-18 17:22:36 -06:00
Simon Larsen
8de13e75f2 refactor: Add aggregate endpoint to BaseAnalyticsAPI
This commit adds the aggregate endpoint to the BaseAnalyticsAPI class. The endpoint allows users to perform aggregation operations on the analytics data. It includes a POST and GET route for aggregating data based on specified criteria. This enhancement improves the functionality and flexibility of the analytics API, enabling users to retrieve aggregated results efficiently.
2024-07-18 17:15:47 -06:00
Simon Larsen
f57a487b13 refactor: Update BaseDatabase types and components
This commit updates the BaseDatabase types and components to include new interfaces and enums for handling aggregation, sorting, and querying of data. It improves the flexibility and functionality of the database operations, enhancing the overall performance and usability of the application.
2024-07-18 17:00:46 -06:00
Simon Larsen
2eb0f51636 refactor: Update DateFilter component to handle FieldType.DateTime
This commit updates the DateFilter component to handle the FieldType.DateTime in addition to FieldType.Date. It ensures that the component can correctly handle both date and date-time filters, improving the flexibility and functionality of the filtering feature.
2024-07-18 14:35:54 -06:00
Simon Larsen
4741d8f9e7 refactor: Update TracesList component to use FieldType.DateTime for "Seen At" field
This commit updates the TracesList component to use the FieldType.DateTime instead of FieldType.Date for the "Seen At" field. This change ensures that the field accurately represents the date and time of when the trace was seen, improving the accuracy and clarity of the telemetry data.
2024-07-18 14:13:43 -06:00
Simon Larsen
4ce5abc918 refactor: Update TelemetryIngest to include serviceName in TelemetryRequest
This commit updates the TelemetryIngest middleware to include the serviceName property in the TelemetryRequest interface. It improves the accuracy and completeness of the telemetry data handling.
2024-07-17 17:50:50 -06:00
Simon Larsen
f041a6cbbb refactor: Update TelemetryIngest to include serviceName in TelemetryRequest
This commit updates the TelemetryIngest middleware to include the serviceName property in the TelemetryRequest interface. This change allows the middleware to access and use the service name when processing telemetry data. It improves the accuracy and completeness of the telemetry data handling.
2024-07-17 17:27:04 -06:00
Simon Larsen
394e5460b5 refactor: Update MetricView and MetricViewPage components
This commit updates the MetricView and MetricViewPage components to include the MetricsAggregationType enum and use it for setting the default aggregation type in the filterData object. This change ensures consistency and clarity in the codebase, improving the maintainability and readability of the application.
2024-07-17 16:50:13 -06:00
Simon Larsen
7a8043f4db refactor: Update MetricAlias component to use title and description instead of metricAlias
This commit updates the MetricAlias component in the Metrics folder to use the properties "title" and "description" instead of "metricAlias". This change improves the clarity and consistency of the codebase, aligning with the naming conventions used throughout the application.
2024-07-17 15:17:18 -06:00
Simon Larsen
7fe26603fd refactor: Update FieldLabelElement component to use consistent text color
This commit updates the FieldLabelElement component in the CommonUI project to use a consistent text color of text-gray-500 instead of text-gray-700. This change improves the visual consistency and readability of the form fields throughout the application.
2024-07-17 14:58:01 -06:00
Simon Larsen
a50cce6c6f refactor: Update MetricsAggregationType enum values to uppercase
This commit updates the MetricsAggregationType enum values to uppercase for consistency and clarity. The previous lowercase values were inconsistent with the naming convention used throughout the codebase. This change improves the readability and maintainability of the code.
2024-07-17 14:50:15 -06:00
Simon Larsen
3c839799da refactor: Update LastRunMessage and TelemetryServices components 2024-07-17 13:42:12 -06:00
Simon Larsen
5a11df0153 refactor: Update LastRunMessage and TelemetryServices components
This commit updates the LastRunMessage component to display a more accurate message about the data update. It also updates the TelemetryServices component to use a clearer title and description. These changes improve the clarity and user experience of the Copilot and Service Catalog pages.
2024-07-16 17:12:05 -06:00
Simon Larsen
bb8b4430cf refactor: Update ServiceFileTypesUtil to use TechStack instead of ServiceLanguage
This commit updates the ServiceFileTypesUtil class to use the TechStack enum instead of the ServiceLanguage enum. It modifies the method names and parameters accordingly, ensuring consistency and clarity in the codebase. This refactoring improves the maintainability and extensibility of the application.
2024-07-16 16:52:40 -06:00
Simon Larsen
c6961b9a0b refactor: Update TelemetryServiceTable component
This commit refactors the Services page by replacing the ModelTable component with the TelemetryServiceTable component. The TelemetryServiceTable component provides a more specialized and optimized table for displaying telemetry services. This change improves the performance and user experience of the Services page.
2024-07-16 16:28:54 -06:00
Simon Larsen
754e6b165e refactor: Update Monitor component props and imports
This commit updates the Monitor component in the Monitor.tsx file to include an optional showIcon prop. It also updates the import paths in various files to reflect the changes. These refactorings improve the flexibility and maintainability of the codebase.
2024-07-16 16:19:36 -06:00
Simon Larsen
5f2430ff06 feat: Add routes for Service Catalog view pages
This commit adds routes for the Monitors, Incidents, and Telemetry Services pages in the Service Catalog view. These routes allow users to navigate to specific sections of the Service Catalog and access relevant information. The addition of these routes enhances the usability and functionality of the application.
2024-07-16 15:08:26 -06:00
Simon Larsen
80b9961bd8 feat: Add breadcrumb links for Monitors, Incidents, and Telemetry Services in Service Catalog view 2024-07-16 15:07:10 -06:00
Simon Larsen
886f753422 refactor: Update TechStack enum and related imports 2024-07-16 14:50:24 -06:00
Simon Larsen
9ea0c6389c refactor: Update repository URL in package.json 2024-07-16 14:44:47 -06:00
Simon Larsen
f29bcc6641 refactor: Update TechStack enum and related imports 2024-07-16 14:43:59 -06:00
Simon Larsen
60aa7032c5 refactor: Update TechStack enum and related imports
This commit updates the TechStack enum in the TechStack.ts file to include a comprehensive list of technology stacks. It also updates the import paths in various files to reflect the changes from using ServiceLanguage to TechStack. This refactoring improves the clarity and consistency of the codebase.
2024-07-16 14:07:47 -06:00
Simon Larsen
4d8ba7d3a3 fix: Update import path for ServiceCatalogTelemetryService model 2024-07-16 13:30:27 -06:00
Simon Larsen
c87744c51e feat: Add ServiceCatalogMonitor and ServiceCatalogTelemetryService models
This commit adds the ServiceCatalogMonitor and ServiceCatalogTelemetryService models to the application. These models are necessary for managing and monitoring service catalog dependencies and telemetry services. The addition of these models enhances the functionality and flexibility of the application.
2024-07-16 11:52:08 -06:00
Simon Larsen
9841ba52a9 feat: Add MetricsAggregationType enum and MetricsQuery interface
This commit adds the MetricsAggregationType enum to represent different types of metrics aggregations such as max, min, sum, avg, and count. It also introduces the MetricsQuery interface, which defines the structure of a metrics query including the metric name, attributes, aggregation type, aggregate by, start time, and end time. These changes enable the implementation of metrics queries and aggregations in the application.
2024-07-15 17:51:19 -06:00
Simon Larsen
b16df022ed chore: Update npm dependency to latest stable version 2024-07-15 15:23:11 -06:00
Simon Larsen
c3d8acc61a feat: Add SquareStack3D icon to IconProp enum and update SideMenu component
This commit adds the SquareStack3D icon to the IconProp enum in the IconProp.ts file. It also updates the SideMenu component in the SideMenu.tsx file to use the SquareStack3D icon instead of the SquareStack icon. This change ensures that the correct icon is displayed in the SideMenu for the specified modelId.
2024-07-15 15:16:26 -06:00
Simon Larsen
04fbb15405 feat: Add Service Catalog Dependency model and routes 2024-07-15 14:49:10 -06:00
Simon Larsen
2cd61dbbac ```text
refactor: Add Service Catalog Dependency permissions

This commit adds new permissions for creating, deleting, editing, and reading Service Catalog Dependencies. These permissions allow users to manage dependencies within the project.
2024-07-15 14:29:05 -06:00
Simon Larsen
e6bc8e4b30 chore: Update Docker configuration for Copilot debugging
This commit updates the Docker configuration in the `.github/workflows/reliability-copilot.yml` file to fix the environment variable values for `ONEUPTIME_REPOSITORY_SECRET_KEY` and `CODE_REPOSITORY_PASSWORD`. The values are now properly enclosed in double quotes to ensure consistency and prevent any issues with special characters. This change ensures the correct configuration for running the reliability copilot workflow.
2024-07-15 14:13:00 -06:00
Simon Larsen
e9f0510d3c chore: Update Docker configuration for Copilot debugging 2024-07-15 14:10:22 -06:00
Simon Larsen
9c0cf6a3db ```text
chore: Update Docker configuration for Copilot debugging

This commit updates the Docker configuration in the `.github/workflows/reliability-copilot.yml` file to fix the environment variable values for `ONEUPTIME_REPOSITORY_SECRET_KEY` and `CODE_REPOSITORY_PASSWORD`. The values are now properly enclosed in single quotes to prevent any issues with special characters. This change ensures the correct configuration for running the reliability copilot workflow.
2024-07-15 14:04:49 -06:00
Simon Larsen
bca58a58ae chore: Fix formatting in InitUtil code
This commit fixes the formatting in the InitUtil code by removing unnecessary whitespace and aligning the code properly. The changes improve the readability and maintainability of the code.
2024-07-15 13:57:37 -06:00
Simon Larsen
2c0fbfef19 feat: Update Docker configuration for Copilot debugging
This commit updates the Docker configuration in the `.vscode/launch.json` file to improve the debugging experience for Copilot. It modifies the `Debug: Copilot Locally` configuration by changing the `localRoot` to `${workspaceFolder}/TestServer` and updating the `name` to `Copilot: Debug with Docker`. Additionally, it sets the `port` to `9985`, `remoteRoot` to `/usr/src/app`, and enables `restart` and `autoAttachChildProcesses` for better debugging capabilities. These changes enhance the development workflow and make it easier to debug Copilot locally with Docker.
2024-07-15 13:52:00 -06:00
Simon Larsen
395f9bcdb7 chore: Update Docker configuration for Copilot debugging 2024-07-15 13:51:35 -06:00
Simon Larsen
4587e3136b feat: Update Docker configuration for Copilot debugging
This commit updates the Docker configuration in the `.vscode/launch.json` file to improve the debugging experience for Copilot. It modifies the `Debug: Copilot Locally` configuration by changing the `localRoot` to `${workspaceFolder}/TestServer` and updating the `name` to `Copilot: Debug with Docker`. Additionally, it sets the `port` to `9985`, `remoteRoot` to `/usr/src/app`, and enables `restart` and `autoAttachChildProcesses` for better debugging capabilities. These changes enhance the development workflow and make it easier to debug Copilot locally with Docker.
2024-07-15 13:31:49 -06:00
Simon Larsen
2a458ec7e6 chore: Update Docker configuration for Copilot debugging 2024-07-15 09:49:21 -06:00
Simon Larsen
2c02a62e63 feat: Update Docker configuration for Copilot debugging
This commit updates the Docker configuration in the `.vscode/launch.json` file to improve the debugging experience for Copilot. It modifies the `Debug: Copilot Locally` configuration by changing the `localRoot` to `${workspaceFolder}/TestServer` and updating the `name` to `Copilot: Debug with Docker`. Additionally, it sets the `port` to `9985`, `remoteRoot` to `/usr/src/app`, and enables `restart` and `autoAttachChildProcesses` for better debugging capabilities. These changes enhance the development workflow and make it easier to debug Copilot locally with Docker.
2024-07-15 09:47:53 -06:00
Simon Larsen
1afd76b080 ```text
refactor: Update Alert component styles

This commit updates the styles of the Alert component to use a common background color of "bg-gray-700" instead of different colors for each alert type. This change simplifies the code and improves consistency in the UI.
2024-07-15 09:15:10 -06:00
Simon Larsen
5fae51fa01 chore: Update CodeRepositoryPage form fields
This commit updates the CodeRepositoryPage form fields by removing the "Main Branch Name" field and adding a "Select Service" dropdown with a description. The "Main Branch Name" field is no longer necessary and the "Select Service" dropdown provides a better user experience by allowing users to choose a service from the Service Catalog. These changes improve the usability and clarity of the form.
2024-07-15 09:13:15 -06:00
Simon Larsen
d8366efee8 feat: Improve MarkdownViewer styles for headings and code blocks 2024-07-15 09:06:15 -06:00
Simon Larsen
5f3cfa3f0d feat: Update Docker configuration for Copilot debugging
This commit updates the Docker configuration in the `.vscode/launch.json` file to improve the debugging experience for Copilot. It modifies the `Debug: Copilot Locally` configuration by changing the `localRoot` to `${workspaceFolder}/TestServer` and updating the `name` to `Copilot: Debug with Docker`. Additionally, it sets the `port` to `9985`, `remoteRoot` to `/usr/src/app`, and enables `restart` and `autoAttachChildProcesses` for better debugging capabilities. These changes enhance the development workflow and make it easier to debug Copilot locally with Docker.
2024-07-15 08:36:23 -06:00
Simon Larsen
39b5982d67 feat: Improve MarkdownViewer styles for headings and code blocks
This commit updates the styles in the MarkdownViewer component to improve the visual hierarchy of headings and code blocks. It adds margin-bottom to h3, h4, and h5 headings to create better spacing between them and the content. Additionally, it removes unnecessary code in the code block rendering logic to simplify the component. These changes enhance the readability and aesthetics of the rendered Markdown content.
2024-07-15 07:36:16 -06:00
Simon Larsen
0f0f2c1b81 feat: Update react-syntax-highlighter to latest version and use a11yDark style
This commit updates the react-syntax-highlighter package to the latest version and switches to the a11yDark style for syntax highlighting in the MarkdownViewer component. This update ensures compatibility with the latest features and improvements of react-syntax-highlighter and enhances the accessibility of the code snippets in the MarkdownViewer.
2024-07-14 15:40:10 -06:00
Simon Larsen
c5062b5bc5 feat: Add @types/react-syntax-highlighter dependency
This commit adds the "@types/react-syntax-highlighter" dependency to the package.json file in the CommonUI directory. This is necessary to provide TypeScript type definitions for the "react-syntax-highlighter" library, ensuring proper type checking and improved development experience.
2024-07-14 14:44:06 -06:00
Simon Larsen
90355ae7ed feat: Add lazy loading for images in PullRequestView 2024-07-14 14:20:04 -06:00
Simon Larsen
da67dc6930 feat: Add network_mode: host to docker-compose.base.yml
This commit adds the `network_mode: host` configuration to the `docker-compose.base.yml` file. This configuration allows the container to share the host network stack, enabling direct access to the host's network interfaces. This change is made to improve network performance and connectivity for the application.
2024-07-14 13:58:48 -06:00
Simon Larsen
71151ea92e feat: Add serviceCatalogId and serviceRepositoryId to CopilotPullRequestAPI and CopilotActionAPI
This commit adds the `serviceCatalogId` and `serviceRepositoryId` fields to the `CopilotPullRequestAPI` and `CopilotActionAPI` classes. These fields are included in the API response to provide additional information about the service catalog and service repository associated with a pull request or action. This change enhances the data returned by the APIs and improves the overall functionality of the application.
2024-07-12 22:04:18 +01:00
Simon Larsen
d97211d52c feat: Set default model name if HF_MODEL_NAME environment variable is not set 2024-07-12 20:40:46 +00:00
Simon Larsen
d0e31ad95e feat: Set default model name if HF_MODEL_NAME environment variable is not set
This commit updates the `app.py` file to set a default model name if the `HF_MODEL_NAME` environment variable is not set. The default model name is `meta-llama/Meta-Llama-3-8B-Instruct`. This change ensures that the application uses a valid model name even if the environment variable is not provided.
2024-07-12 20:39:18 +00:00
Simon Larsen
7c796e110b feat: Add environment variables for Hugging Face token and model name
This commit adds the necessary environment variables for the Hugging Face token and model name in the `docker-compose.yml` file. The `HF_TOKEN` environment variable is used to store the Hugging Face API token, which can be obtained by signing up on Hugging Face and creating a new API token. The `HF_MODEL_NAME` environment variable is optional and allows specifying the model name from Hugging Face. If not set, the default model `meta-llama/Meta-Llama-3-8B-Instruct` will be used.
2024-07-12 20:37:03 +00:00
Simon Larsen
137cdb7716 refactor: Remove unused code and comments in LLMServer.ts 2024-07-12 20:18:34 +00:00
Simon Larsen
0a02aba790 feat: Add lazy loading for images in PullRequestView 2024-07-12 20:17:57 +00:00
Simon Larsen
652e81e984 feat: Add lazy loading for images in PullRequestView
This commit adds lazy loading for images in the PullRequestView component. By implementing lazy loading, the images will only load when they are in the viewport, improving the page load performance and user experience.
2024-07-12 21:13:05 +01:00
Simon Larsen
4dacd9b8b4 chore: Delete all data from CopilotAction table in MigrationName1720785305192
This commit deletes all data from the "CopilotAction" table in the "MigrationName1720785305192" migration. This is done to ensure a clean state before renaming the "pullRequestId" column to "copilotPullRequestId".
2024-07-12 20:43:31 +01:00
Simon Larsen
71fb83e698 feat: Update CopilotAction table to allow nullable copilotPullRequestId
This commit modifies the `CopilotAction` table in the `CopilotAction.ts` file to allow the `copilotPullRequestId` column to be nullable. This change provides flexibility in the data model by allowing the column to have null values.
2024-07-12 20:38:33 +01:00
Simon Larsen
d514059d5d chore: Setup Git LFS in workflows
This commit adds a step to the GitHub workflows (`test-release.yaml` and `release.yml`) to setup Git LFS. Git LFS is necessary for handling large files in the repository. By installing Git LFS, we ensure that the repository can handle large files properly during the CI/CD process.
2024-07-12 20:28:46 +01:00
Simon Larsen
3c29278cc1 run on self hosted runner 2024-07-12 20:14:37 +01:00
Simon Larsen
5d1ad931fc chore: Remove unused Copilot configuration variables
This commit removes the unused Copilot configuration variables from the `config.example.env` file. The `COPILOT_OPENAI_API_KEY` and `COPILOT_OPENAI_MODEL` variables are no longer needed and have been removed. This cleanup improves the clarity and maintainability of the codebase.
2024-07-12 19:36:33 +01:00
Simon Larsen
4e0d56de54 feat: Add setup pull request flag to CopilotPullRequestAPI.ts
This commit adds the `isSetupPullRequest` flag to the `CopilotPullRequestAPI.ts` file. The flag is set to true when creating a pull request for setting up the repository with OneUptime Copilot. This flag will be used to identify setup pull requests in the application.
2024-07-12 19:02:47 +01:00
Simon Larsen
a33b1f20f8 feat: Add migration for dropping NOT NULL constraint on serviceCatalogId and serviceRepositoryId in CopilotPullRequest
This commit adds a migration file (1720806196274-MigrationName.ts) that drops the NOT NULL constraint on the columns "serviceCatalogId" and "serviceRepositoryId" in the "CopilotPullRequest" table. This change allows these columns to have nullable values, providing flexibility in the data model.
2024-07-12 18:46:41 +01:00
Simon Larsen
9fa61dac31 feat: Add OneUptimeDate import in CopilotCodeRepositoryAPI
This commit adds an import statement for the `OneUptimeDate` module in the `CopilotCodeRepositoryAPI.ts` file. The `OneUptimeDate` module is used to update the last run time of the code repository.
2024-07-12 18:36:30 +01:00
Simon Larsen
263c1ee613 feat: Update CopilotPullRequest.ts and PageMap.ts
Update the table description in CopilotPullRequest.ts to fix a typo. Also, add a new entry in PageMap.ts for the "AI_COPILOT_CODE_REPOSITORY_VIEW_PULL_REQUESTS" page.
2024-07-12 13:38:19 +01:00
Simon Larsen
c648a6bf79 feat: Add CopilotPullRequestStatus enum
This commit adds the `CopilotPullRequestStatus` enum to the `CopilotPullRequestStatus.ts` file in the `Common/Types/Copilot` directory. This enum defines the possible statuses of a Copilot pull request, including "Created", "Merged", and "Closed". This enum will be used to track the status of Copilot pull requests throughout the application.
2024-07-12 13:07:59 +01:00
Simon Larsen
ed954d79a4 fix ingress 2024-07-12 12:05:29 +01:00
Simon Larsen
113e95a059 add fluentd host to ingress 2024-07-12 11:29:37 +01:00
Simon Larsen
4d31b85c4d add otel collector to ingress 2024-07-12 11:26:54 +01:00
Simon Larsen
58cf3abda9 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-12 11:23:00 +01:00
Simon Larsen
9227324ac3 fix port name on ingress 2024-07-12 11:21:53 +01:00
Simon Larsen
eb19465e56 Merge pull request #1580 from OneUptime/snyk-upgrade-94a17e29c2b95dff68863238e84f80f4
[Snyk] Upgrade eslint-plugin-react from 7.34.2 to 7.34.3
2024-07-11 17:13:14 +01:00
Simon Larsen
93ee819457 Merge pull request #1582 from OneUptime/snyk-upgrade-6b6d73fe55c776290de78e647adb1b35
[Snyk] Upgrade @opentelemetry/instrumentation-fetch from 0.51.1 to 0.52.0
2024-07-11 17:13:06 +01:00
snyk-bot
7931ac475e fix: upgrade @opentelemetry/instrumentation-fetch from 0.51.1 to 0.52.0
Snyk has created this PR to upgrade @opentelemetry/instrumentation-fetch from 0.51.1 to 0.52.0.

See this package in npm:
@opentelemetry/instrumentation-fetch

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-07-11 06:55:27 +00:00
snyk-bot
9d43a2d98b fix: upgrade eslint-plugin-react from 7.34.2 to 7.34.3
Snyk has created this PR to upgrade eslint-plugin-react from 7.34.2 to 7.34.3.

See this package in npm:
eslint-plugin-react

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/c3622982-05c8-495c-809c-20f301c75f92?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-07-11 06:34:56 +00:00
Simon Larsen
54db88dd96 feat: Add git commands to add and commit changes in CodeRepositoryUtil
The CodeRepositoryUtil class now includes two new methods: `addAllChangedFilesToGit` and `commitChanges`. These methods allow for adding all changed files to the git repository and committing the changes with a specified message. This will make it easier to manage and track changes in the code repository.
2024-07-10 22:53:31 +01:00
Simon Larsen
dd336896d2 chore: Remove unused configuration files and scripts 2024-07-10 22:07:52 +01:00
Simon Larsen
2862d1e69b Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-10 21:33:40 +01:00
Simon Larsen
5e486e4ce6 chore: Update LlmType enum and related code 2024-07-10 21:33:38 +01:00
Simon Larsen
6b17d6d6dc Merge pull request #1574 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-voNYL
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Utils/Resources.ts
2024-07-10 21:32:05 +01:00
simlarsen
272a29aad1 OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Utils/Resources.ts 2024-07-10 20:31:24 +00:00
Simon Larsen
d21e333c9e Update config.example.env to disable copilot 2024-07-10 21:05:47 +01:00
Simon Larsen
b5195c27c0 chore: Add OpenAI configuration to Copilot
- Update config.example.env to include OpenAI API key and model.
- Update docker-compose.base.yml to include OpenAI environment variables.
- Update Copilot configuration files to handle OpenAI LLM responses.
2024-07-10 20:59:46 +01:00
Simon Larsen
3f436861ad Merge pull request #1569 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-ewnDg
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Model.ts
2024-07-10 20:49:10 +01:00
Simon Larsen
3982d49136 Merge pull request #1570 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-nHnSE
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/PageNotFound.ts
2024-07-10 20:48:40 +01:00
Simon Larsen
e007fb1b72 Merge pull request #1571 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-Mrwii
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Pagination.ts
2024-07-10 20:48:31 +01:00
Simon Larsen
ccba9482de Merge pull request #1572 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-ooCrw
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Permissions.ts
2024-07-10 20:48:15 +01:00
Simon Larsen
8dfa8c2e09 Merge pull request #1573 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-yaNuN
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Status.ts
2024-07-10 20:47:57 +01:00
Simon Larsen
af0a5d1022 chore: Update LlmType enum and related code 2024-07-10 18:39:13 +01:00
Simon Larsen
43a22d9973 chore: Update LlmType enum and related code
- Update LlmType enum values to match the new naming convention.
- Update references to Llama to LLM in various files.
- Update CopilotActionsBase.ts to set the llmType to LLM in the constructor.
- Update Init.ts to use the llmServerUrl instead of llamaServerUrl.
- Update LLM.ts to use LLMServer class instead of Llama class.
- Add OpenAI class and update LLM.ts to handle OpenAI LLM type.
- Update Config.ts to handle OpenAI API key and model.
- Add OpenAI.ts file to handle OpenAI LLM responses.
2024-07-10 18:36:00 +01:00
Simon Larsen
d8c8a76c1d chore: Update Copilot configuration files
- Update Copilot Dockerfile.tpl to remove unnecessary code and fix formatting.
- Update config.example.env and Copilot/.env.example to correct the LLM server URL.
- Remove unused code and update documentation in Copilot/README.md.
- Update navigation links in App/FeatureSet/Docs/Utils/Nav.ts to include Copilot documentation.
- Update Copilot/Config.ts and Copilot/Utils/Init.ts to use the new LLM server URL.
- Add logger statements in Copilot/Service/CopilotActions/CopilotActionsBase.ts to log file content.
2024-07-10 18:19:09 +01:00
simlarsen
e40dc2e9ff OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/Status.ts 2024-07-10 13:01:43 +00:00
simlarsen
e0769f1d2b OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/Permissions.ts 2024-07-10 13:00:58 +00:00
simlarsen
e336d2ad38 OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/Pagination.ts 2024-07-10 13:00:09 +00:00
simlarsen
6ca6daf38d OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/PageNotFound.ts 2024-07-10 12:59:15 +00:00
simlarsen
ffa6f143ac OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/Model.ts 2024-07-10 12:58:24 +00:00
Simon Larsen
04650f165f chore: Add logger to Execute.ts and fix formatting in Config.ts and Init.ts 2024-07-10 13:50:29 +01:00
Simon Larsen
214c4e4839 chore: Await discardAllChangesOnCurrentBranch in Copilot/Init.ts 2024-07-10 13:43:59 +01:00
Simon Larsen
fad530cf86 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-10 13:39:46 +01:00
Simon Larsen
6b9e0c8b99 chore: Disable Copilot in development environment 2024-07-10 13:39:35 +01:00
Simon Larsen
5a66e9a393 Merge pull request #1568 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-TJVih
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Introduction.ts
2024-07-10 13:23:50 +01:00
simlarsen
ddd5813266 OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/Introduction.ts 2024-07-10 12:23:07 +00:00
Simon Larsen
e246e3fbcd Update npm aliases in .bash_profile 2024-07-10 12:18:14 +01:00
Simon Larsen
e1f4cc22ac chore: Add git and Kubernetes aliases 2024-07-10 12:12:46 +01:00
Simon Larsen
6911cf59f4 pin otel collector version 2024-07-10 11:56:26 +01:00
Simon Larsen
5172d7f349 chore: Add CORS headers to Telemetry and OTelCollector
This commit adds CORS headers to the Telemetry and OTelCollector components to allow cross-origin resource sharing. This enables the client to make requests to these components from different origins. The headers include "Access-Control-Allow-Credentials", "Access-Control-Allow-Origin", "Access-Control-Allow-Methods", and "Access-Control-Allow-Headers".
2024-07-10 11:48:22 +01:00
Simon Larsen
55e043f3bd Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-10 11:15:04 +01:00
Simon Larsen
bdee2f0585 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-10 10:14:05 +00:00
Simon Larsen
833ca82cb7 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-10 11:13:15 +01:00
Simon Larsen
6751972d7f Merge pull request #1564 from OneUptime/snyk-upgrade-3232471f850f8871f36776389f11aae2
[Snyk] Upgrade @opentelemetry/instrumentation-xml-http-request from 0.51.1 to 0.52.0
2024-07-10 11:11:18 +01:00
Simon Larsen
44ed919f95 Merge pull request #1565 from OneUptime/snyk-upgrade-7d66d03180c77c4ca697278c523089b6
[Snyk] Upgrade react-big-calendar from 1.12.2 to 1.13.0
2024-07-10 11:10:45 +01:00
Simon Larsen
c8ad2a1ac8 Merge pull request #1566 from OneUptime/snyk-upgrade-95f152c7f03c4ab700ab8a5a552aa96c
[Snyk] Upgrade posthog-js from 1.138.0 to 1.139.3
2024-07-10 11:10:36 +01:00
Simon Larsen
232b537969 Merge pull request #1567 from OneUptime/snyk-upgrade-7c8fb9ccde1fd7e55540a2005ae62b07
[Snyk] Upgrade globals from 15.4.0 to 15.6.0
2024-07-10 11:10:30 +01:00
Simon Larsen
d5c8e7836f Refactor MigrationName1720532068612 to delete all records from CopilotAction and drop a foreign key constraint 2024-07-10 11:09:44 +01:00
snyk-bot
e897955466 fix: upgrade globals from 15.4.0 to 15.6.0
Snyk has created this PR to upgrade globals from 15.4.0 to 15.6.0.

See this package in npm:
globals

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/c3622982-05c8-495c-809c-20f301c75f92?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-07-10 06:13:29 +00:00
snyk-bot
4f3ae06e59 fix: upgrade posthog-js from 1.138.0 to 1.139.3
Snyk has created this PR to upgrade posthog-js from 1.138.0 to 1.139.3.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-07-10 06:12:11 +00:00
snyk-bot
e971bdaee9 fix: upgrade react-big-calendar from 1.12.2 to 1.13.0
Snyk has created this PR to upgrade react-big-calendar from 1.12.2 to 1.13.0.

See this package in npm:
react-big-calendar

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-07-10 06:06:23 +00:00
snyk-bot
d165ce86df fix: upgrade @opentelemetry/instrumentation-xml-http-request from 0.51.1 to 0.52.0
Snyk has created this PR to upgrade @opentelemetry/instrumentation-xml-http-request from 0.51.1 to 0.52.0.

See this package in npm:
@opentelemetry/instrumentation-xml-http-request

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-07-10 06:06:18 +00:00
Simon Larsen
ec704cbe34 Refactor executeScript function to execute multiple commands sequentially 2024-07-09 21:06:40 +01:00
Simon Larsen
658cb9fee3 refactor: Update URL for validating secret key in app.py
The code changes in `app.py` update the URL for validating the secret key. The previous URL was using the endpoint `/api/code-repository/is-valid/{secretKey}`, and it has been changed to `/api/copilot-code-repository/is-valid/{secretKey}`. This change ensures that the correct endpoint is used for validating the secret key in the OneUptime service.
2024-07-09 19:38:29 +00:00
Simon Larsen
3234112644 Refactor CORS headers to allow all origins and additional headers 2024-07-09 20:08:45 +01:00
Simon Larsen
0c7db14e99 Refactor Telemetry and TelemetryIngest classes to use URL class from Common/Types/API/URL 2024-07-09 20:02:12 +01:00
Simon Larsen
34118d5892 chore: Fix typo in npm run command 2024-07-09 18:52:26 +01:00
Simon Larsen
2ee80ee2f9 chore: Refactor CopilotCodeRepositoryAPI to remove unnecessary onBeforeCommitScript, onBeforeRepositoryCloneScript, onAfterCommitScript, and onAfterRepositoryCloneScript properties 2024-07-09 18:12:08 +01:00
Simon Larsen
aaacaa654b chore: Refactor executeAction function to use typescript interfaces and types 2024-07-09 17:51:36 +01:00
Simon Larsen
d8c38a3564 chore: Add necessary configuration files for OneUptime service 2024-07-09 17:40:26 +01:00
Simon Larsen
add77694c3 chore: Add necessary configuration files for OneUptime service 2024-07-09 16:34:58 +01:00
Simon Larsen
66171e8035 chore: Remove unnecessary columns from CopilotCodeRepository table 2024-07-09 16:33:06 +01:00
Simon Larsen
932d218455 chore: Update import paths for CodeRepository to CopilotCodeRepository 2024-07-09 14:42:19 +01:00
Simon Larsen
33a295c191 chore: Update import paths for CodeRepository to CopilotCodeRepository 2024-07-09 14:17:05 +01:00
Simon Larsen
4c0f1b08c8 chore: Add onBeforeCommitScript, onBeforeRepositoryCloneScript, onAfterCommitScript, and onAfterRepositoryCloneScript properties to CopilotCodeRepository model 2024-07-09 14:14:04 +01:00
Simon Larsen
f58e935cb9 chore: Update import paths for CodeRepository to CopilotCodeRepository 2024-07-09 14:07:42 +01:00
Simon Larsen
ad48ea5a3f chore: Update import paths for CodeRepository to CopilotCodeRepository 2024-07-09 13:55:59 +01:00
Simon Larsen
3a4ae31872 chore: Update import paths for CodeRepository to CopilotCodeRepository 2024-07-09 13:53:50 +01:00
Simon Larsen
48996b0810 Merge remote-tracking branch 'origin/snyk-upgrade-cd470ff382f3ed998304bb88ef9afe7f' 2024-07-09 13:03:57 +01:00
Simon Larsen
d450c99560 Merge remote-tracking branch 'origin/snyk-upgrade-65126f8b570e3a8824e5969f0e718753' 2024-07-09 13:01:33 +01:00
Simon Larsen
51884a31cd Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-09 12:55:04 +01:00
Simon Larsen
5251b93fc9 refactor: Improve logging in Llama class 2024-07-09 12:54:49 +01:00
Simon Larsen
ac3635511c Merge pull request #1535 from OneUptime/snyk-upgrade-a5008561a01273d3fcf7af71de29b60d
[Snyk] Upgrade @opentelemetry/instrumentation from 0.51.1 to 0.52.0
2024-07-09 12:53:36 +01:00
Simon Larsen
0990ef0846 Merge pull request #1556 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-csMvV
[OneUptime Copilot] Improve Comments on /App/FeatureSet/Docs/Utils/Render.ts
2024-07-09 12:52:44 +01:00
simlarsen
294b245d88 OneUptime Copilot: Improve Comments on /App/FeatureSet/Docs/Utils/Render.ts 2024-07-09 11:44:50 +00:00
Simon Larsen
3eb3564c57 Merge pull request #1548 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-BFXsW
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/Pagination.ts
2024-07-09 12:37:05 +01:00
Simon Larsen
851f061018 Merge pull request #1547 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-eTbgL
[OneUptime Copilot] Improve Comments on /App/FeatureSet/ApiReference/Service/PageNotFound.ts
2024-07-09 12:36:18 +01:00
Simon Larsen
e9a2c64d67 Merge pull request #1555 from OneUptime/oneuptime-app-oneuptime-app-improve-comments-OeXvG
[OneUptime Copilot] Improve Comments on /App/FeatureSet/Docs/Utils/Nav.ts
2024-07-09 12:34:24 +01:00
simlarsen
f9b72e0155 OneUptime Copilot: Improve Comments on /App/FeatureSet/Docs/Utils/Nav.ts 2024-07-09 11:31:45 +00:00
simlarsen
834fd23542 OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/Pagination.ts 2024-07-09 11:09:53 +00:00
simlarsen
14b45b95a4 OneUptime Copilot: Improve Comments on /App/FeatureSet/ApiReference/Service/PageNotFound.ts 2024-07-09 11:09:36 +00:00
Simon Larsen
74d4a6545e Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-08 20:00:01 +01:00
Simon Larsen
646c0f37d6 refactor: Improve logging in Llama class 2024-07-08 19:59:58 +01:00
Simon Larsen
1fdc36fea2 refactor: Update logging in Llama class for better debugging 2024-07-08 19:56:27 +01:00
Simon Larsen
a34a6657f0 feat: Add max_new_tokens parameter to job function
The code changes in `app.py` add a new parameter `max_new_tokens` to the `job` function. This parameter allows the maximum number of new tokens to be specified when calling the function. This change enhances the flexibility and control of the `job` function by allowing the maximum number of new tokens to be adjusted as needed.
2024-07-08 18:46:22 +00:00
Simon Larsen
95f87567e8 refactor: Improve logging in Llama class
This commit improves the logging in the Llama class by adding more detailed log messages. It modifies the log statements in the execute method to include the current file path and the type of Copilot action being executed. This change enhances the readability and debugging capabilities of the Llama service.
2024-07-08 18:15:27 +01:00
Simon Larsen
9ad97b1fe0 refactor: Add timeout handling to Llama prompt execution
This commit adds timeout handling to the Llama prompt execution in the Llama class. It introduces a timeoutInMinutes property in the CopilotActionPrompt interface and uses it to set a timeout for the prompt execution. If the prompt execution exceeds the specified timeout, a LLMTimeoutException is thrown, indicating that the prompt has timed out. This change enhances the reliability and responsiveness of the Llama service by preventing long-running prompts from blocking the execution flow.
2024-07-08 18:06:06 +01:00
Simon Larsen
9b9e6d666b refactor: Update CodeRepositoryUtil to set author identity 2024-07-08 16:36:22 +01:00
Simon Larsen
24845b267f refactor: Set author identity in CodeRepositoryUtil
This commit adds a new method, setAuthorIdentity, to the CodeRepositoryUtil class. The method sets the author's name and email in the global git configuration using the provided data. It executes the necessary git config command and logs the output. This change enhances the functionality of the CodeRepositoryUtil class by allowing the author's identity to be easily configured for git operations.
2024-07-08 16:19:19 +01:00
Simon Larsen
448326ee88 refactor: Add LOG_LEVEL=DEBUG environment variable to docker-compose.copilot.yml
This commit adds the LOG_LEVEL=DEBUG environment variable to the docker-compose.copilot.yml file. Setting the log level to DEBUG will enable more detailed logging for the Copilot service. This change is made to improve debugging and troubleshooting capabilities during development and testing.
2024-07-08 16:01:51 +01:00
Simon Larsen
12dab7bdda refactor: Update Docker Compose configuration for Copilot
This commit updates the Docker Compose configuration for Copilot. It removes the unnecessary volume mapping for the COPILOT_REPOSITORY_LOCAL_PATH in the docker-compose.copilot.yml file. This change improves the clarity and simplicity of the configuration file.
2024-07-08 15:48:05 +01:00
Simon Larsen
3eba4da4a8 refactor: Update CODE_REPOSITORY_PASSWORD and CODE_REPOSITORY_USERNAME environment variables
This commit updates the environment variables CODE_REPOSITORY_PASSWORD and CODE_REPOSITORY_USERNAME in the Copilot project. The previous variables GITHUB_TOKEN and GITHUB_USERNAME have been replaced with the new variables to improve clarity and consistency. The changes are made in multiple files, including .github/workflows/reliability-copilot.yml, Copilot/.env.example, Copilot/Config.ts, Copilot/Utils/CodeRepository.ts, Copilot/Utils/Init.ts, config.example.env, and docker-compose.base.yml. These updates ensure that the correct credentials are used for accessing the code repository in the Copilot project.
2024-07-08 15:45:14 +01:00
Simon Larsen
b947ed2ed1 refactor: Add cloneRepository method to CodeRepositoryUtil
This commit adds a new method, cloneRepository, to the CodeRepositoryUtil class. The method is responsible for cloning a repository from a given URL to a specified path. It uses the git clone command to perform the cloning operation. This method will be used to clone the repository to a temporary directory in the Copilot/Init.ts file. The method takes an object as a parameter, which includes the repoPath and repoUrl. It executes the git clone command using the Execute.executeCommand() method and logs the output using the logger.debug() method. This new method enhances the functionality of the CodeRepositoryUtil class and improves the codebase.
2024-07-08 15:40:16 +01:00
Simon Larsen
6eef29e4a3 refactor: Update Copilot configuration for local development 2024-07-08 14:05:09 +01:00
Simon Larsen
74c2de8adc refactor: Add npm scripts for running Copilot and LLM in development mode
This commit adds npm scripts for running Copilot and LLM in development mode. It introduces the "dev-copilot" and "dev-llm" scripts in the package.json file, which set up the necessary environment variables and start the respective services using docker-compose. These scripts enable developers to easily run and test Copilot and LLM locally during development.
2024-07-08 12:56:33 +01:00
Simon Larsen
f53b314b59 refactor: Update Copilot configuration for local development 2024-07-08 12:51:27 +01:00
Simon Larsen
e4bf81fcc1 refactor: Update Copilot configuration for local development
This commit updates the Copilot configuration for local development. It adds environment variables and services to the docker-compose.base.yml and package.json files to support running Copilot locally. The changes include adding the "copilot" service to the docker-compose.base.yml file with the necessary environment variables for Copilot functionality. Additionally, it adds new npm scripts in the package.json file to start, build, and force-build Copilot. These updates enable developers to easily run and build Copilot locally for testing and development purposes.
2024-07-08 12:11:52 +01:00
Simon Larsen
00b48b16ce refactor: Update NODE_OPTIONS stack trace limit to 30 in Dockerfile.tpl 2024-07-05 13:00:16 +01:00
Simon Larsen
5b00b5dac1 refactor: Update Monitor.ts to improve error handling and populate secrets
This commit refactors the Monitor.ts file to enhance error handling and populate secrets for monitors. It introduces try-catch blocks and proper logging to handle errors more effectively. Additionally, it populates secrets for monitors using the MonitorUtil.populateSecrets() function. These changes improve the reliability and security of the monitoring process.
2024-07-05 12:56:53 +01:00
Simon Larsen
97306d47fa refactor: Update default replica count for all deployments 2024-07-05 12:37:38 +01:00
Simon Larsen
5df9f9fd69 refactor: Refresh probe status when isEnabled is updated in MonitorProbeService.ts 2024-07-05 11:52:05 +01:00
Simon Larsen
d9ce813689 refactor: Update ingestor replica count based on configuration 2024-07-05 11:26:26 +01:00
Simon Larsen
93f1b97e88 refactor: Improve error handling in Monitor.ts
This commit refactors the Monitor.ts file to improve error handling. It removes commented out code and unused imports, ensuring a cleaner and more efficient codebase. This change enhances the maintainability and readability of the code.
2024-07-05 11:16:29 +01:00
Simon Larsen
c617e49a63 refactor: Update ingestor replica count based on configuration
This commit updates the ingestor replica count in the HelmChart/Public/oneuptime/templates/ingestor.yaml file based on the configuration. If the `$.Values.deployment.ingestor.replicaCount` value is provided, it sets the replicas to that value. Otherwise, it falls back to `$.Values.deployment.replicaCount`. This change ensures that the ingestor replica count is correctly configured, improving the scalability and performance of the application.
2024-07-05 10:51:19 +01:00
Simon Larsen
de7d06e5d7 refactor: Improve error handling in FetchListAndProbe
This commit refactors the FetchListAndProbe class to improve error handling. It adds try-catch blocks around the main logic and logs any errors that occur using the logger. Additionally, it includes a catch block to handle any errors thrown during the fetchListAndProbe function. This change ensures that errors are properly handled and logged, preventing potential issues with the monitoring process.
2024-07-05 10:18:03 +01:00
Simon Larsen
9b862162b6 refactor: Remove Hugging Face model download step from workflows
The Hugging Face model download step has been removed from the release and test workflows due to limited disk space on the runner. This step was causing issues and is no longer necessary for the current functionality of the project.
2024-07-05 10:05:19 +01:00
Simon Larsen
0ecf3fa1e0 refactor: Remove commented out code and unused imports in Monitor.ts 2024-07-05 09:54:34 +01:00
Simon Larsen
b5fa564cb3 refactor: Remove LLM/Models from .dockerignore 2024-07-05 09:29:05 +01:00
Simon Larsen
b771e1486e Update Hugging Face model download command in release and test workflows 2024-07-05 09:27:20 +01:00
Simon Larsen
3f1479d8f5 refactor: Improve error handling in Semaphore.lock()
This commit refactors the Semaphore.lock() function in the MonitorStatusTimelineService and Monitor API files to improve error handling. It adds try-catch blocks around the lock() function calls and logs any errors that occur using the logger. This change ensures that errors during the locking process are properly handled and logged, preventing potential issues with mutex locking.
2024-07-05 09:05:36 +01:00
Simon Larsen
dcdf1e21ae chore: Free up disk space in GitHub Actions runner 2024-07-04 22:40:38 +01:00
Simon Larsen
cc3f003be5 refactor: Improve error handling in FetchListAndProbe
This commit refactors the FetchListAndProbe class to improve error handling. It adds try-catch blocks around the main logic and logs any errors that occur using the logger. Additionally, it includes a catch block to handle any errors thrown during the fetchListAndProbe function. This change ensures that errors are properly handled and logged, preventing potential issues with the monitoring process.
2024-07-04 22:22:37 +01:00
Simon Larsen
0e53e26695 refactor: Update PROBE_MONITOR_FETCH_LIMIT default value to 10
This commit updates the default value of the PROBE_MONITOR_FETCH_LIMIT variable in the Config.ts file from 1 to 10. This change ensures that the monitor fetch limit is set to a more reasonable value, improving the efficiency of the monitoring process.
2024-07-04 21:05:03 +01:00
Simon Larsen
ad1e5fefc6 refactor: Improve error handling in Semaphore.lock()
This commit refactors the Semaphore.lock() function in the MonitorStatusTimelineService and Monitor API files to improve error handling. It adds try-catch blocks around the lock() function calls and logs any errors that occur using the logger. This change ensures that errors during the locking process are properly handled and logged, preventing potential issues with mutex locking.
2024-07-04 20:52:19 +01:00
Simon Larsen
8ea77dc6d1 chore: Update BillingInvoiceAPI to check for userAuthorization.isMasterAdmin when userPermissions is empty 2024-07-04 10:50:40 +01:00
Simon Larsen
2222ca301f feat: Update count property in docker-compose.llm.yml to use 'all'
This commit updates the count property in the docker-compose.llm.yml file to use the value 'all' instead of the previous value of '1'. This change allows for the allocation of all available devices with the 'gpu' capability, improving the utilization of resources.
2024-07-03 17:48:43 +01:00
Simon Larsen
0f66c70205 refactor: Update issue template titles
This commit removes the redundant "Bug:" and "Enhancement:" prefixes from the issue template titles. The prefixes are unnecessary as the labels already indicate the type of issue. This change simplifies the issue creation process and improves the clarity of the issue templates.
2024-07-03 17:37:10 +01:00
Simon Larsen
88dc64f182 feat: Add new migration for SchemaMigrations
This commit adds a new migration file, MigrationName1720024126646, to the SchemaMigrations directory. This migration will be used to make changes to the database schema.
2024-07-03 17:35:24 +01:00
Simon Larsen
94c50b980a feat: Add disableCreate prop to MonitorTable component 2024-07-03 17:26:33 +01:00
Simon Larsen
9866919873 feat: Add new icons for NoSignal and EyeSlash
This commit adds two new icons, NoSignal and EyeSlash, to the IconProp enum. It also includes the necessary code changes in the Icon component to render these icons. These icons will be used in the Monitor SideMenu to represent monitors with all probes disconnected and monitors with all probes disabled, respectively.
2024-07-03 16:55:31 +01:00
Simon Larsen
e025f996e4 feat: Add Monitor Groups and Not Being Monitored sections to Dashboard SideMenu 2024-07-03 16:43:39 +01:00
Simon Larsen
cd4c326f6e refactor: Update PermissionHelper to use access control permissions for probe actions
This commit updates the PermissionHelper class to use access control permissions for probe actions. Previously, the isAccessControlPermission property was set to false for all probe-related permissions. Now, it has been changed to true, aligning with the intention of these permissions. This change improves the clarity and consistency of the codebase.
2024-07-03 14:58:11 +01:00
Simon Larsen
c668731389 chore: Add new monitor notification settings for probe status changes and no probes monitoring the monitor 2024-07-03 14:56:57 +01:00
Simon Larsen
e6a10edca6 chore: Add new monitor notification settings for probe status changes and no probes monitoring the monitor 2024-07-02 19:42:28 +01:00
Simon Larsen
847f7fa5c9 chore: Update MonitorTypeHelper function names to be more descriptive
This commit updates the function names in the MonitorTypeHelper class to be more descriptive and accurately reflect their purpose. The function isProbableMonitors has been renamed to isProbableMonitor, and doesMonitorTypeHaveInterval has been renamed to doesMonitorTypeRequireInterval. This change improves the clarity and maintainability of the codebase.
2024-07-02 18:58:06 +01:00
Simon Larsen
03cb9a67b4 chore: Update server monitor criteria to evaluate over time
This commit updates the ServerMonitorCriteria class to include the option to evaluate criteria over time. It adds a new condition to check if the criteria filter includes the evaluateOverTimeOptions property. If it does, the criteria will be evaluated based on the specified time value in minutes. This change allows for more flexible and customizable monitoring criteria.
2024-07-02 17:14:58 +01:00
Simon Larsen
9791aa1259 chore: Add CPU core count to CPUMetrics
This commit adds the `cores` field to the `CPUMetrics` struct in order to include the number of CPU cores in the collected metrics. This information is useful for understanding the processing power of the server.
2024-07-02 13:54:04 +01:00
Simon Larsen
0df7209723 feat: Add basic infrastructure metrics to server monitor summary view 2024-07-02 13:06:23 +01:00
Simon Larsen
0de8e2d818 chore: Add hostname to server monitor report
This commit adds the hostname field to the server monitor report in order to include the hostname of the server in the collected metrics. This information is useful for identifying and distinguishing between different servers in the monitoring system.
2024-07-02 13:04:02 +01:00
Simon Larsen
5f9a1091de chore: Update Dockerfile paths in release and test-release workflows
This commit updates the paths to the Dockerfile in the release.yml and test-release.yaml workflows. The paths have been changed to ./LLM/Dockerfile to ensure that the correct Dockerfile is used for building and pushing the image. This change is necessary because the base image of the LLM does not support arm64 platforms.
2024-07-02 12:55:52 +01:00
Simon Larsen
6ef17b1720 chore: Update Dockerfile to set stack trace limit to 0
This commit updates the Dockerfile to set the stack trace limit to 0, allowing full stack traces to be shown. This change ensures that developers have access to complete stack trace information when debugging the application.
2024-07-02 12:29:31 +01:00
Simon Larsen
9c41a20ebb chore: Update Dockerfile paths in release and test-release workflows
This commit updates the paths to the Dockerfile in the release.yml and test-release.yaml workflows. The paths have been changed to ./LLM/Dockerfile to ensure that the correct Dockerfile is used for building and pushing the image. This change is necessary because the base image of the LLM does not support arm64 platforms.
2024-07-02 12:23:03 +01:00
Simon Larsen
eddb5a81c9 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-02 12:20:47 +01:00
Simon Larsen
3861d09930 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-07-02 11:20:24 +00:00
Simon Larsen
733901a870 refactor: Use array of messages in CopilotActionsBase.ts, RefactorCode.ts, ImproveReadme.ts, ImproveVariableNames.ts, FixGrammarAndSpelling.ts, and WriteUnitTests.ts
This refactor changes the code in CopilotActionsBase.ts, RefactorCode.ts, ImproveReadme.ts, ImproveVariableNames.ts, FixGrammarAndSpelling.ts, and WriteUnitTests.ts to use an array of messages instead of a single prompt. Each message in the array contains the content and role of the prompt, improving flexibility and readability.
2024-07-02 11:19:53 +00:00
Simon Larsen
131c3034d6 chore: Update installation script to add binary to path
The installation script has been updated to add the binary to the user's path. This ensures that the oneuptime-infrastructure-agent command can be accessed from anywhere in the shell.
2024-07-02 12:19:14 +01:00
Simon Larsen
0c9175c728 fix install script for mac 2024-07-02 12:11:21 +01:00
Simon Larsen
e2eff652e3 chore: Update notification method description in NotificationSettings.tsx 2024-07-02 11:25:36 +01:00
Simon Larsen
43e9530fdb chore: Update notification method description in NotificationSettings.tsx
This commit updates the description of the notification methods in the NotificationSettings.tsx file. The previous description mentioned "custom porbe" instead of "custom probe". This change improves the accuracy and clarity of the description, ensuring that it correctly reflects the purpose of the notification methods.
2024-07-02 11:23:24 +01:00
Simon Larsen
0000cbc53e chore: Add migration for new SchemaMigrations
This commit adds a new migration file, MigrationName1719915433542, to the SchemaMigrations directory. The migration is necessary to update the database schema and ensure compatibility with the latest changes in the codebase.
2024-07-02 11:19:31 +01:00
Simon Larsen
8b26cac8f0 ```text
chore: Update ProbeAPI.test.ts to include connectionStatus field in select query

This commit modifies the ProbeAPI.test.ts file to include the connectionStatus field in the select query. The connectionStatus field was missing from the original query, and this change ensures that it is now included, providing complete information about the probe's connection status.
2024-07-02 11:14:42 +01:00
Simon Larsen
e8417b23d9 chore: Update ProbeConnectionStatusChange template to display "Status Since" instead of "Date / Time" 2024-07-01 22:45:10 +01:00
Simon Larsen
1bd5671d17 chore: Update lastAlive field to Status Since in ProbeConnectionStatusChange template
This commit updates the ProbeConnectionStatusChange template to display the last connection status change as "Status Since" instead of "Date / Time". The change improves the clarity and accuracy of the displayed information, providing a better user experience.
2024-07-01 22:22:51 +01:00
Simon Larsen
56d3e7e1f2 chore: Update probeKey type to string in CustomProbeDocumentation and ProbeView components
This commit updates the probeKey prop type from ObjectID to string in the CustomProbeDocumentation and ProbeView components. The probeKey is used to identify the probe and was previously defined as ObjectID, but it should be a string. This change ensures that the probeKey is correctly passed and used throughout the components, improving the accuracy and reliability of the application.
2024-07-01 20:00:16 +01:00
Simon Larsen
34888e9b7f chore: Update CustomProbeDocumentation component title
This commit updates the title of the CustomProbeDocumentation component from "Set up your Server Monitor (Linux/Mac)" to "Set up your Custom Probe". The new title accurately reflects the purpose of the component and improves the clarity of the user interface.
2024-07-01 17:51:28 +01:00
Simon Larsen
7c09423766 chore: Update ProbeStatusElement component to use connectionStatus field 2024-07-01 17:34:04 +01:00
Simon Larsen
9ba8251c58 chore: Update ProbeStatusElement component to use connectionStatus field 2024-07-01 17:19:27 +01:00
Simon Larsen
7a5efd99ca chore: Update ProbeStatusElement component to use connectionStatus field
This commit updates the ProbeStatusElement component to use the new connectionStatus field from the Probe model. The component previously relied on the lastAlive field to determine the probe's connection status, but now it directly checks the connectionStatus field. This change ensures that the component accurately reflects the probe's current connection status, improving the reliability of the application.
2024-07-01 17:12:33 +01:00
Simon Larsen
1e595be586 feat: Add notification settings for probe owner added event
This commit adds notification settings for the "probe owner added" event. It includes updates to the EmailTemplateType enum, NotificationSettingEventType enum, UserNotificationSettingService, and NotificationSettings.tsx. The new settings allow users to receive notifications when they are added as owners to a probe. This enhancement improves the user experience by providing timely notifications for ownership changes.
2024-07-01 17:06:35 +01:00
Simon Larsen
1d63168606 chore: Add connectionStatus field to Probe model and update related components 2024-07-01 16:52:16 +01:00
Simon Larsen
82601a3e8f chore: Disable editing and deleting of probes in ProbePage component
This commit disables the editing and deleting functionality for probes in the ProbePage component. The isEditable and isDeleteable props are set to false, preventing users from modifying or removing probes. This change ensures that probes cannot be accidentally modified or deleted, improving the data integrity of the application.
2024-07-01 14:41:25 +01:00
Simon Larsen
17bf63e83b chore: Add missing commas in Index.ts files
This commit adds missing commas in the Index.ts files of the Model/Models and CommonServer/Infrastructure/Postgres/SchemaMigrations directories. The missing commas were causing syntax errors in the code. This fix ensures that the code is valid and can be executed without errors.
2024-07-01 14:12:06 +01:00
Simon Larsen
885a6ca36e feat: Add ProbeOwnerTeam and ProbeOwnerUser APIs
This commit adds the APIs for ProbeOwnerTeam and ProbeOwnerUser, allowing users to manage ownership of probes within the application. The APIs are implemented in the BaseAPI/Index.ts file and include routes for creating, deleting, editing, and reading probe owner teams and users. This enhancement improves the functionality of the application by providing a way to manage probe ownership.
2024-07-01 14:02:49 +01:00
Simon Larsen
dec35bbc03 chore: Update model-inline-code styles for consistency
This commit updates the model-inline-code styles in the model.ejs and head.ejs files to ensure consistency throughout the application. The model-inline-code class is now defined with rounded corners, smaller text size, and a gray background color. This change improves the visual presentation of code snippets in the application.
2024-07-01 13:52:49 +01:00
Simon Larsen
77dcb16e8b feat: Add permissions for creating, deleting, editing, and reading probe owner teams and users 2024-07-01 13:42:17 +01:00
Simon Larsen
b10a4c7db8 feat: Add permissions for creating, deleting, editing, and reading probe owner teams and users
This commit adds new permissions for creating, deleting, editing, and reading probe owner teams and users. These permissions allow users to manage ownership of probes within the application. The permissions are defined in the Permission enum and are accompanied by titles and descriptions for clarity. This enhancement improves the access control functionality of the application.
2024-07-01 13:39:07 +01:00
Simon Larsen
8d82f1128b chore: Add ProbeConnectionStatusChange email template
This commit adds a new email template, "ProbeConnectionStatusChange.hbs", to the EmailTemplateType enum in the EmailTemplateType.ts file. The template is used for sending emails related to changes in probe connection status. This addition enhances the email functionality of the application.
2024-07-01 13:07:11 +01:00
Simon Larsen
056c069c69 chore: Add migration for new ProbeStatus column
This commit adds a new migration file, "1719827175832-MigrationName", to the SchemaMigrations directory. The migration file includes the necessary changes to add a new column, "connectionStatus", to the Probe model in the Models directory. The column is of type "ShortText" and has access control settings for create and read permissions. This migration enables the storage and retrieval of the connection status of a probe in the database.
2024-07-01 10:47:24 +01:00
Simon Larsen
0466950c2d chore: Update axios and posthog-js dependencies
This commit updates the axios and posthog-js dependencies in the package-lock.json file. The axios dependency is updated from version 1.6.8 to 1.7.2, and the posthog-js dependency is updated from version 1.131.4 to 1.138.0. These updates ensure that the latest stable versions of these libraries are used in the project.
2024-07-01 10:43:11 +01:00
Simon Larsen
4442437ad7 refactor: Improve comments and error handling in Llama.ts and ImproveComments.ts 2024-07-01 10:39:27 +01:00
snyk-bot
1192c4b6f0 fix: upgrade @opentelemetry/instrumentation from 0.51.1 to 0.52.0
Snyk has created this PR to upgrade @opentelemetry/instrumentation from 0.51.1 to 0.52.0.

See this package in npm:
@opentelemetry/instrumentation

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-29 05:38:32 +00:00
Simon Larsen
08f39af9ec refactor: Improve comments and handle bad operations in Llama.ts and ImproveComments.ts
This commit refactors the code in Llama.ts and ImproveComments.ts to improve comments and handle bad operations. In Llama.ts, a new import statement for the BadOperationException class is added, and if the result object contains an error string, a BadOperationException is thrown. In ImproveComments.ts, an unused variable declaration is removed. These changes enhance code readability and error handling.
2024-06-28 19:25:53 +01:00
Simon Larsen
7bf58d23bc chore: Update CopilotActionsBase.ts, RefactorCode.ts, ImproveReadme.ts, ImproveVariableNames.ts, FixGrammarAndSpelling.ts, and WriteUnitTests.ts
Refactor CopilotActionsBase.ts, RefactorCode.ts, ImproveReadme.ts, ImproveVariableNames.ts, FixGrammarAndSpelling.ts, and WriteUnitTests.ts to use an array of messages instead of a single prompt. Each message in the array contains the content and role of the prompt. This change improves the flexibility and readability of the code.
2024-06-28 19:15:53 +01:00
Simon Larsen
afb0cbcc2a chore: Update Dockerfile and docker-compose.llm.yml for LLM models 2024-06-28 18:00:27 +00:00
Simon Larsen
7393d9c2bc chore: Update Dockerfile and docker-compose.llm.yml for LLM models
This commit updates the Dockerfile and docker-compose.llm.yml files to include the LLM Models directory. The Dockerfile now uses the `ADD .` command to copy the entire repository into the container at `/app`, and the docker-compose.llm.yml file has been modified to set the context to the `./LLM` directory. These changes ensure that the LLM Models directory is included in the Docker image and that the correct context is used for building the image.
2024-06-28 17:59:43 +00:00
Simon Larsen
7b8efb2785 Update Dockerfile to set stack trace limit to 0 2024-06-28 17:52:57 +01:00
Simon Larsen
efea6f4c11 chore: Add Redis service to docker-compose.llm.yml
The Redis service has been added to the docker-compose.llm.yml file. This service is responsible for caching and cluster state. It extends the configuration from the docker-compose.base.yml file and uses the "redis" service defined there.
2024-06-28 17:42:43 +01:00
Simon Larsen
8dbf724f36 chore: Update Dockerfile in llm-docker-image-deploy workflow to use the correct volume mount path 2024-06-28 17:37:47 +01:00
Simon Larsen
fa4c705023 chore: Update Dockerfile in reliability-copilot.yml to use the correct volume mount path 2024-06-28 15:10:19 +01:00
Simon Larsen
106e41206e Update nav menu styling and product menu layout 2024-06-28 14:55:58 +01:00
Simon Larsen
dc0c71b063 Remove unused GitHub workflow files for Dependabot Automerge and Playwright Tests. These files are no longer needed and can be safely deleted.
Update the Dockerfile in the Copilot directory to use the correct volume mount path. This ensures that the Copilot tool can access the repository files correctly when running in a Docker container.
2024-06-28 14:47:27 +01:00
Simon Larsen
0cadb54117 chore: Update AI Copilot references to "Reliability Copilot" 2024-06-28 14:20:56 +01:00
Simon Larsen
0ba315342c Update product tabs and features table content 2024-06-28 14:08:49 +01:00
Simon Larsen
d87b292691 chore: Update Hugging Face clone URL in test-release.yaml
Fix a typo in the Hugging Face clone URL in the test-release.yaml file, which was causing the cloning process to fail. The "@" symbol was missing in the URL. This commit adds the missing "@" symbol to the URL.
2024-06-28 13:53:26 +01:00
Simon Larsen
ea3abf2ca0 chore: Update Banner component to handle optional link and openInNewTab props
The Banner component has been updated to handle optional link and openInNewTab props. If a link is provided, it will be wrapped in a Link component. If no link is provided, the content will be rendered directly. This change allows for more flexibility in using the Banner component.
2024-06-28 13:16:58 +01:00
Simon Larsen
3e507c0259 chore: Update Hugging Face clone URL in test-release.yaml
Fix a typo in the Hugging Face clone URL in the test-release.yaml file, which was causing the cloning process to fail. The "@" symbol was missing in the URL. This commit adds the missing "@" symbol to the URL.
2024-06-28 13:09:54 +01:00
Simon Larsen
5385c8e65c chore: Update AI Copilot references to "Reliability Copilot" 2024-06-28 13:05:35 +01:00
Simon Larsen
771ad54110 chore: Update reliability feature name to "Reliability Copilot" 2024-06-28 13:03:31 +01:00
Simon Larsen
6743193872 chore: Update LLM Dockerfile and build process 2024-06-28 12:18:01 +01:00
Simon Larsen
b94d862cae chore: Update LLM Dockerfile and build process 2024-06-28 12:14:49 +01:00
Simon Larsen
77d9b2f98f chore: Fix typo in Hugging Face clone URL
The Hugging Face clone URL in the test-release.yaml file had a missing "@" symbol, causing the cloning process to fail. This commit fixes the typo by adding the "@" symbol to the URL.

```
2024-06-28 12:00:10 +01:00
Simon Larsen
2565087dba Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-28 11:59:16 +01:00
Simon Larsen
5f330b5ea6 chore: Update Dockerfile and build process for LLM deployment
This commit updates the Dockerfile and build process for deploying the LLM (Llama Models) service. The Dockerfile has been generated from the Dockerfile.tpl file, and the build process now includes pulling the model from Hugging Face and setting up QEMU and Docker Buildx. Additionally, the login actions for Docker Hub and GitHub Container Registry have been added, and the build and push steps have been configured to use the updated tags and labels from the metadata action.

```
2024-06-28 11:59:13 +01:00
Simon Larsen
c5f6816d7b chore: Update Llama Models directory name to LLM 2024-06-28 11:53:09 +01:00
Simon Larsen
585b98c83d Merge pull request #1530 from OneUptime/copilot
Copilot
2024-06-28 11:35:03 +01:00
Simon Larsen
40635d5b07 Merge pull request #1531 from OneUptime/snyk-upgrade-7358ffa5d00ca86f76a1a45e96b3c33d
[Snyk] Upgrade posthog-js from 1.136.7 to 1.138.0
2024-06-28 11:34:55 +01:00
Simon Larsen
fd96f7a1ec Merge pull request #1533 from OneUptime/snyk-upgrade-28d9d373998545ed12a47fad19fc0238
[Snyk] Upgrade @opentelemetry/resources from 1.24.1 to 1.25.0
2024-06-28 11:34:47 +01:00
Simon Larsen
f585ffe756 chore: Update npm scripts for LLM deployment
The npm scripts for starting, building, and force-building the LLM (Llama Models) service have been updated in the package.json file. The new scripts use the docker-compose.llm.yml file instead of the docker-compose.ai.yml file. This change ensures that the correct configuration is used for deploying the LLM service.
2024-06-28 11:33:48 +01:00
Simon Larsen
9a86978c9d chore: Update Llama Models directory name to LLM
The directory name for Llama Models has been updated from "Llama/Models" to "LLM/Models". This change ensures consistency and aligns with the updated file paths in the codebase.
2024-06-28 11:32:44 +01:00
Simon Larsen
3bf87cf9eb Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-28 10:51:48 +01:00
Simon Larsen
b7b5288f9c ```text
chore: Set oneuptimeSecret and encryptionSecret to long random strings

The `oneuptimeSecret` and `encryptionSecret` values in the `values.yaml` file have been updated to be set to long random strings. This change ensures better security for OneUptime in production environments.
2024-06-28 10:51:45 +01:00
snyk-bot
2833dbb474 fix: upgrade @opentelemetry/resources from 1.24.1 to 1.25.0
Snyk has created this PR to upgrade @opentelemetry/resources from 1.24.1 to 1.25.0.

See this package in npm:
@opentelemetry/resources

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-28 06:07:03 +00:00
snyk-bot
2a6dda5fe2 fix: upgrade posthog-js from 1.136.7 to 1.138.0
Snyk has created this PR to upgrade posthog-js from 1.136.7 to 1.138.0.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-28 05:58:30 +00:00
Simon Larsen
e9e5b5a329 chore: Add error handling for item processing
This commit adds error handling for item processing in the `job` function of `app.py`. When an error occurs while processing an item, the error is stored in the `errors` dictionary. This ensures that errors are captured and can be handled appropriately. The `queue-status` endpoint now includes the `errors` dictionary in the response, providing visibility into any processing errors that occurred.
2024-06-27 20:23:24 +00:00
Simon Larsen
c0e055343e chore: Remove unused import of json in app.py 2024-06-27 20:19:56 +00:00
Simon Larsen
c657397d3b chore: Convert messages from JSON string to list in create_item endpoint 2024-06-27 20:19:44 +00:00
Simon Larsen
91cf4995b1 chore: Convert messages from JSON string to list in create_item endpoint 2024-06-27 20:11:57 +00:00
Simon Larsen
7b7c1e5951 chore: Convert messages from JSON string to list in create_item endpoint 2024-06-27 18:37:02 +00:00
Simon Larsen
b67583f8d3 refactor: Update Llama.ts to fix API route for prompt result 2024-06-27 19:16:49 +01:00
Simon Larsen
460b8459d4 chore: Update Llama Readme with GPU usage instructions 2024-06-27 17:51:46 +00:00
Simon Larsen
8328ece011 chore: Update docker-compose command in test.e2e.yaml 2024-06-27 17:48:41 +00:00
Simon Larsen
6f4045ffe9 refactor: Update SubscriptionPlan method name to getPlanType 2024-06-27 18:00:08 +01:00
Simon Larsen
54ce2c71c0 chore: Update docker-compose command in test.e2e.yaml 2024-06-27 16:27:59 +00:00
Simon Larsen
0a00cd9581 refactor: Update SubscriptionPlan method name to getPlanType 2024-06-27 16:00:21 +01:00
Simon Larsen
162c5d9db9 add queue to process responses 2024-06-27 14:56:22 +00:00
Simon Larsen
8be8c23ed9 refactor: Refactor code into smaller functions/methods 2024-06-27 15:48:52 +01:00
Simon Larsen
f2b6fffb4c chore: Add error handling for item processing
This commit adds error handling for item processing in the `job` function of `app.py`. When an error occurs while processing an item, the error is stored in the `errors` dictionary. This ensures that errors are captured and can be handled appropriately. The `queue-status` endpoint now includes the `errors` dictionary in the response, providing visibility into any processing errors that occurred.
2024-06-27 13:57:05 +00:00
Simon Larsen
626312d495 refactor: Refactor code into smaller functions/methods 2024-06-27 14:33:25 +01:00
Simon Larsen
77287868c4 refactor: Improve variable names in codebase 2024-06-27 14:15:18 +01:00
Simon Larsen
f7d221900a chore: Add error handling to ServerMonitor:CheckOnlineStatus 2024-06-27 13:40:07 +01:00
Simon Larsen
d51a420532 chore: Update docker-compose command in test.e2e.yaml
The `docker-compose` command in the `test.e2e.yaml` file has been updated to use `docker compose` instead. This change ensures compatibility with the latest version of Docker and improves the consistency of command usage across the project.
2024-06-27 13:18:57 +01:00
Simon Larsen
0567f92ddd chore: Update docker-compose command in test.e2e.yaml
The `docker-compose` command in the `test.e2e.yaml` file has been updated to use `docker compose` instead. This change ensures compatibility with the latest version of Docker and improves the consistency of command usage across the project.
2024-06-27 13:10:25 +01:00
Simon Larsen
e88e29f9e5 refactor: Update install.sh to support Windows OS 2024-06-27 11:58:14 +01:00
Simon Larsen
e50f6e14f0 chore: Update Server Monitor documentation for Linux/Mac and Windows
The Server Monitor documentation in the `Documentation.tsx` file has been updated to provide separate instructions for setting up the monitor on Linux/Mac and Windows. The title of the Linux/Mac section has been modified to reflect this change. Additionally, the Windows section has been added with detailed steps for downloading, configuring, starting, and stopping the agent. This update improves the clarity and usability of the Server Monitor documentation.
2024-06-27 11:57:35 +01:00
Simon Larsen
933b3e96a1 chore: Update pricing page with new features and descriptions 2024-06-27 11:36:53 +01:00
Simon Larsen
00b67974ed chore: Update pricing page with new headline
The pricing page has been updated to replace the previous headline with a new one that better highlights the value proposition of OneUptime. The new headline emphasizes that OneUptime is a comprehensive platform that combines 8+ tools into one, providing users with a complete SRE toolchain. This change improves the clarity and effectiveness of the messaging on the pricing page.
2024-06-27 11:18:06 +01:00
Simon Larsen
a05a7d9122 chore: Fix typos in code comments and UI text 2024-06-27 11:17:26 +01:00
Simon Larsen
fdf440f308 chore: Update HomeFeatureSet in Index.ts
The `HomeFeatureSet` object in `Index.ts` has been updated to modify the values for the `Public Status Page` and `Subscribers` features. The `free` plan for `Public Status Page` has been changed from "Unlimited" to "1", and the `free` plan for `Subscribers` has been changed from "Unlimited" to "100". Additionally, a new feature called `Synthetic Monitoring (with Playwright)` has been added to the `HomeFeatureSet` object.
2024-06-27 11:16:40 +01:00
Simon Larsen
34c6a32c48 refactor: Update install.sh to support Windows OS 2024-06-27 10:50:32 +01:00
Simon Larsen
0b078226f3 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-27 10:29:38 +01:00
Simon Larsen
e0a5927bd1 refactor: Improve CopilotActionService file handling
This commit refactors the `CopilotActionService` class in the `Index.ts` file to improve file handling. It updates the logic for obtaining the result from the Copilot action and committing the changes to the repository. Additionally, it removes unused code and improves the readability of the file. This refactoring enhances the overall efficiency and maintainability of the `CopilotActionService` class.
2024-06-27 10:29:35 +01:00
Simon Larsen
bed1f0dbb5 Merge pull request #1528 from OneUptime/snyk-upgrade-81e090968d72376d6229e5d49596cc79
[Snyk] Upgrade @opentelemetry/semantic-conventions from 1.24.1 to 1.25.0
2024-06-27 10:29:18 +01:00
Simon Larsen
4fef8ccfb5 Merge pull request #1526 from OneUptime/snyk-upgrade-274375204ccf65ed6f3d939f4cd74fda
[Snyk] Upgrade @opentelemetry/context-zone from 1.24.1 to 1.25.0
2024-06-27 10:29:07 +01:00
Simon Larsen
bb29b4be4b Merge pull request #1524 from OneUptime/snyk-upgrade-579a7cc9445a00c813ed17b2ba523e50
[Snyk] Upgrade posthog-js from 1.136.2 to 1.136.7
2024-06-27 10:29:00 +01:00
snyk-bot
e649a6f25a fix: upgrade @opentelemetry/exporter-trace-otlp-http from 0.51.1 to 0.52.0
Snyk has created this PR to upgrade @opentelemetry/exporter-trace-otlp-http from 0.51.1 to 0.52.0.

See this package in npm:
@opentelemetry/exporter-trace-otlp-http

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-27 06:02:00 +00:00
snyk-bot
078d89d8ae fix: upgrade @opentelemetry/semantic-conventions from 1.24.1 to 1.25.0
Snyk has created this PR to upgrade @opentelemetry/semantic-conventions from 1.24.1 to 1.25.0.

See this package in npm:
@opentelemetry/semantic-conventions

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-27 06:01:55 +00:00
snyk-bot
a13c172d6d fix: upgrade @opentelemetry/api from 1.8.0 to 1.9.0
Snyk has created this PR to upgrade @opentelemetry/api from 1.8.0 to 1.9.0.

See this package in npm:
@opentelemetry/api

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-27 06:01:50 +00:00
snyk-bot
6b4727bc9f fix: upgrade @opentelemetry/context-zone from 1.24.1 to 1.25.0
Snyk has created this PR to upgrade @opentelemetry/context-zone from 1.24.1 to 1.25.0.

See this package in npm:
@opentelemetry/context-zone

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-27 06:01:45 +00:00
Simon Larsen
95aaa68010 refactor: Update install.sh to support Windows OS 2024-06-26 22:05:09 +01:00
Simon Larsen
976686b5af refactor: Update install.sh to support Windows OS
The `install.sh` script has been updated to support the Windows operating system. This includes changes to the URL construction and the addition of logic to handle downloading and unzipping the binary for Windows. This enhancement improves the installation process for Windows users.
2024-06-26 22:02:12 +01:00
Simon Larsen
f59064108e refactor: Add isActionComplete method to CopilotActionsBase.ts
This commit adds a new method, `isActionComplete`, to the `CopilotActionsBase.ts` file. The method returns a boolean value indicating whether the action is complete. By default, the method returns `true`, but it can be overridden in derived classes to provide custom logic for determining the action's completion status. This enhancement improves the flexibility and extensibility of the `CopilotActionsBase` class.
2024-06-26 21:47:20 +01:00
Simon Larsen
44d8254e7d refactor: Remove unused getNextFilePath method in CopilotActionsBase.ts 2024-06-26 21:43:13 +01:00
Simon Larsen
d284a6ff54 refactor: Remove unused getNextFilePath method in CopilotActionsBase.ts 2024-06-26 21:40:39 +01:00
Simon Larsen
1908f02447 refactor: Extract code from CopilotActionBase to separate functions 2024-06-26 21:40:07 +01:00
Simon Larsen
f50e20d896 refactor: Extract code from CopilotActionBase to separate functions 2024-06-26 20:55:14 +01:00
Simon Larsen
bd8ed04e1b refactor: Extract code from CopilotActionBase to separate functions
This commit extracts code from the `CopilotActionBase.ts` file into separate functions for better code organization and readability. The extracted code includes the logic for ordering SSL certificates, checking the order status, and handling domain removal. This refactoring improves the maintainability and modularity of the codebase.
2024-06-26 19:33:01 +01:00
Simon Larsen
27c54221cb feat: Mark domain as not ordered and update SSL status
This commit updates the `StatusPageDomainService.ts` file to mark a domain as not ordered and update the SSL status when it is removed. The `notifyDomainRemoved` function now includes logic to update the `isSslOrdered` and `isSslProvisioned` properties to `false` for the specified domain. This ensures that the SSL certificate is not ordered or provisioned for the removed domain.
2024-06-26 14:42:17 +01:00
Simon Larsen
cf589ba0c6 refactor: Remove invalid domain and notify removal
The code changes in GreenlockUtil.ts remove the domain if the CNAME is not valid and notify the removal. This ensures that only valid domains are processed for ordering SSL certificates.
2024-06-26 14:38:26 +01:00
Simon Larsen
43eaff3a6d feat: Add logic to order SSL certificate for valid domains
The code changes in `StatusPageDomainService.ts` add logic to order an SSL certificate for valid domains. If the CNAME is valid, the code attempts to order the certificate using the `orderCert` function. This ensures that all valid domains have the necessary SSL protection.
2024-06-26 14:31:08 +01:00
Simon Larsen
30e96de2d9 refactor: Check order status for SSL certificates
This commit adds a new cron job in the `StatusPageCerts.ts` file to check the order status of SSL certificates for domains that have already ordered them. If a certificate does not exist for a domain, the code will attempt to order the certificate again. This ensures that all domains with ordered certificates have the necessary SSL protection.
2024-06-26 14:25:35 +01:00
Simon Larsen
43c4f44f1f refactor: Check order status for SSL certificates
This commit adds a new cron job in the `StatusPageCerts.ts` file to check the order status of SSL certificates for domains that have already ordered them. If a certificate does not exist for a domain, the code will attempt to order the certificate again. This ensures that all domains with ordered certificates have the necessary SSL protection.
2024-06-26 14:24:49 +01:00
Simon Larsen
af6f5af11d Update phone number placeholders in registration and subscription forms 2024-06-26 12:36:27 +01:00
snyk-bot
79603c9bb4 fix: upgrade posthog-js from 1.136.2 to 1.136.7
Snyk has created this PR to upgrade posthog-js from 1.136.2 to 1.136.7.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-26 05:31:20 +00:00
Simon Larsen
e2074b010e refactor: Add notification webhook on user creation
This commit adds a notification webhook on user creation in the UserService. When a new user is created, a Slack message is sent to the specified webhook URL with details about the user's email, name, phone number, and company name. This feature enhances the user onboarding process and allows for better tracking and communication with new users.
2024-06-25 22:48:46 +01:00
Simon Larsen
2187edc158 refactor: Update Select.ts and Project.ts for better code organization and readability 2024-06-25 22:16:08 +01:00
Simon Larsen
a9778cf9d0 refactor: Update Copilot README.md file
This commit adds a blank line at the end of the Copilot README.md file. This change ensures consistency in the file structure and improves readability.
2024-06-25 12:09:25 +01:00
Simon Larsen
c450c3fa1b ```text
refactor: Update server_name in Nginx configuration

This commit updates the server_name directive in the Nginx configuration file to remove the ${HOST}:${ONEUPTIME_HTTP_PORT} variable and use just ${HOST}. This change ensures that the server_name is set correctly for all domains.
2024-06-24 21:43:24 +01:00
Simon Larsen
3aaed9c901 refactor: Update OneUptime port in nginx.yaml
This commit updates the ONEUPTIME_HTTP_PORT value in the nginx.yaml file to use the port specified in the $.Values.port.nginxHttp variable. This change ensures that OneUptime is hosted on the correct port.
2024-06-24 19:59:36 +01:00
Simon Larsen
70a9944f6a refactor: Update Nginx configuration to enable HTTP/2
This commit updates the Nginx configuration file to enable HTTP/2 by removing the `http2` directive from the `listen` directive and adding a separate `http2` directive. This change ensures that the server supports the latest HTTP/2 protocol, improving performance and security.
2024-06-24 19:56:45 +01:00
Simon Larsen
ad48aae0ba ```text
refactor: Update OneUptime port in config.example.env

This commit updates the ONEUPTIME_HTTP_PORT value in the config.example.env file to 80. This change ensures that OneUptime is hosted on the correct port.
2024-06-24 19:47:15 +01:00
Simon Larsen
14f9950c38 Update container port names for status page in nginx.yaml 2024-06-24 19:45:01 +01:00
Simon Larsen
4acedfdd62 Update nginx.yaml and values.yaml for hosting OneUptime and status page on different ports 2024-06-24 19:42:46 +01:00
Simon Larsen
deff7c9464 refactor: Add missing comma in SchemaMigrations/Index.ts 2024-06-24 19:19:52 +01:00
Simon Larsen
b407286ef0 refactor: Add migration for new schema version 2024-06-24 19:18:26 +01:00
Simon Larsen
9348076df0 refactor: Improve error handling in CheckHeartbeat.ts
This commit improves the error handling in the CheckHeartbeat.ts file. It adds a try-catch block around the main logic to catch any errors that occur during the processing of incoming request monitors. Additionally, it logs the error message and the ID of the monitor that caused the error. This change enhances the robustness and reliability of the code by properly handling and logging errors.
2024-06-24 18:50:59 +01:00
Simon Larsen
09a7e155b7 refactor: Update Project.ts to use number type for enterpriseAnnualContractValue column
The code changes in Project.ts modify the type of the enterpriseAnnualContractValue column from ShortText to Number. This change ensures that the column stores numeric values instead of text, improving data integrity and query performance.
2024-06-24 17:45:36 +01:00
Simon Larsen
127cc6b9b1 refactor: Add logging statements for IncomingRequestMonitor
This commit adds logging statements to the IncomingRequestMonitor module to improve debugging and monitoring. The added log messages provide information about the number of incoming request monitors found and whether a monitor should process a request. This change enhances the visibility and understanding of the monitoring process.
2024-06-24 17:31:42 +01:00
Simon Larsen
ea5474527c refactor: Update CompareCriteria message formatting
This commit refactors the CompareCriteria class to update the message formatting for different filter types. The previous implementation included the word "threshold" in the message, which is unnecessary and can be confusing. The updated message now clearly states whether the value is greater than, greater than or equal to, less than, less than or equal to, or not equal to the threshold value. This change improves the clarity and readability of the message generated by the CompareCriteria class.
2024-06-24 14:28:05 +01:00
Simon Larsen
9111b831a7 chore: Update docker-compose.dev.yml command in test.e2e.yaml 2024-06-24 13:29:34 +01:00
Simon Larsen
dcabdd0a55 refactor: Remove unused CopilotEvent table
This commit removes the unused CopilotEvent table from the database schema. The table is no longer needed and has been dropped to improve database performance and reduce clutter.
2024-06-24 12:52:57 +01:00
Simon Larsen
058b585eda refactor: Add migration for new schema version
This commit adds a new migration file for the latest schema version. The migration file is named "1719228104620-MigrationName". This ensures that the database schema is up to date with the latest changes.
2024-06-24 12:23:15 +01:00
Simon Larsen
25da20a968 refactor: Add migration for enterprise annual contract value column 2024-06-24 12:16:01 +01:00
Simon Larsen
4f4d9946ff Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-23 21:37:38 +01:00
Simon Larsen
0987634e54 refactor: Fix formatting and add comments in ArrayUtil.ts and CopilotActionProcessingException.ts 2024-06-23 21:37:36 +01:00
Simon Larsen
c099f3a3ef refactor: Improve error handling in app.py
The error handling in app.py has been improved to catch and handle exceptions that occur during the processing of items in the queue. This change ensures that errors are properly logged and that the affected items are removed from the pending items list.
2024-06-23 20:31:43 +00:00
Simon Larsen
a3f5e268b5 refactor: Shuffle files in Copilot Init to avoid fixing the same file in each run 2024-06-23 21:29:23 +01:00
Simon Larsen
2599841d37 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-23 21:04:49 +01:00
Simon Larsen
6c8a0c8cdc refactor: Improve file extension handling in LocalFile.ts 2024-06-23 21:04:46 +01:00
Simon Larsen
0d24bb6351 Merge pull request #1504 from OneUptime/snyk-upgrade-48794e3e1c0fd38df637134c9642af47
[Snyk] Upgrade posthog-js from 1.136.1 to 1.136.2
2024-06-23 21:01:01 +01:00
Simon Larsen
a4c5354152 refactor: Improve comments in ImproveComments.ts 2024-06-23 20:58:21 +01:00
Simon Larsen
a906713f6e Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-23 19:41:26 +01:00
Simon Larsen
e85e351797 refactor: Remove unnecessary blank lines in ServiceLanguageUtil class 2024-06-23 19:41:24 +01:00
Simon Larsen
3f9c1fd46e Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-23 18:40:56 +00:00
Simon Larsen
6c3edbfcb0 ```text
refactor: Update app.py to use asyncio.create_task for job function

The job function in app.py has been updated to use the asyncio.create_task method instead of directly calling the job function. This change improves the efficiency and performance of the code by allowing the job function to run concurrently with other tasks.
2024-06-23 18:40:38 +00:00
Simon Larsen
d3f212c9ec Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-23 19:35:07 +01:00
Simon Larsen
1964db22f1 refactor: Add support for Markdown file extension in ServiceLanguage enum 2024-06-23 19:35:04 +01:00
Simon Larsen
b6a70bbd6c refactor: Convert job function to async in app.py 2024-06-23 18:23:15 +00:00
Simon Larsen
f36609712b refactor: Add print statements to debug message processing in app.py 2024-06-23 18:13:39 +00:00
Simon Larsen
6737d97f30 refactor: Improve comments in ImproveComments.ts 2024-06-23 18:00:44 +01:00
Simon Larsen
d22b40e91a refactor: Improve comments in ImproveComments.ts 2024-06-23 18:00:16 +01:00
Simon Larsen
e2e4db5073 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-22 19:40:21 +01:00
Simon Larsen
2415f97ec6 refactor: Add NotAcceptedFileExtentionForCopilotAction exception handling 2024-06-22 19:40:18 +01:00
Simon Larsen
0910c9f6f6 Merge branch 'ai-copilot-main' 2024-06-22 12:43:42 +00:00
Simon Larsen
1a02f5b73e refactor: Update queue_status endpoint response key name
The key name in the response of the queue_status endpoint has been updated from "prnding" to "pending" to fix a typo. This change ensures consistency and improves the readability of the returned data.
2024-06-22 12:43:04 +00:00
Simon Larsen
b6cabf12d5 refactor: Update CopilotActionsBase to include PR generation message
This commit updates the `CopilotActionsBase.ts` file to include a message about PR generation in the warning section. The message informs users that the PR is generated by OneUptime Copilot and advises them to review the changes before merging. This enhancement improves the clarity and transparency of the generated PRs.
2024-06-22 13:36:52 +01:00
Simon Larsen
27ef73be20 refactor: Execute CopilotAction and update currentFixCount
This commit modifies the `Copilot/Init.ts` file to execute the `CopilotActionService.execute` method for each event that needs fixing. It also updates the `currentFixCount` variable to keep track of the number of fixes performed. This refactor improves the functionality of the Copilot service by ensuring that all necessary actions are executed and the fix count is accurately maintained.
2024-06-22 13:34:54 +01:00
Simon Larsen
00b35c4d9a refactor: Convert job function to async in app.py
The job function in app.py has been converted to an async function to support asynchronous processing. This change improves the performance and responsiveness of the application by allowing other tasks to run concurrently while the job function is processing the queue.
2024-06-22 12:31:53 +00:00
Simon Larsen
369bdfc841 ```text
refactor: Add FixGrammarAndSpelling action to CopilotActionType and CopilotActions

This commit adds the `FixGrammarAndSpelling` action to the `CopilotActionType` enum and the `CopilotActions` dictionary. The action is now available for execution in the Copilot service. This enhancement improves the codebase by providing a new action that can be used to fix grammar and spelling errors in the application.
2024-06-22 12:50:54 +01:00
Simon Larsen
8150f44244 refactor: Improve comments in ImproveComments.ts 2024-06-22 12:42:34 +01:00
Simon Larsen
6a646c06b3 refactor: Remove unused CopilotActionType enum value
This commit removes the unused `CopilotActionType` enum value from the `CopilotActionType.ts` file. The value was commented out and had no impact on the functionality of the application. Removing it helps to improve code clarity and maintainability.
2024-06-22 12:38:27 +01:00
Simon Larsen
422656caf3 refactor: Remove unused PromptsUtil class
This commit removes the unused `PromptsUtil` class from the codebase. The class was no longer being used and had no impact on the functionality of the application. Removing it helps to reduce code complexity and improve maintainability.
2024-06-22 12:35:38 +01:00
Simon Larsen
5223d1bd6d refactor: Improve comments in CopilotActionType and CopilotActionsBase
The code changes in this commit refactor the comments in the `CopilotActionType` and `CopilotActionsBase` files. The comments have been improved to provide clearer instructions and guidelines for code commenting. This enhancement ensures that the codebase is well-documented and easier to understand for future developers.
2024-06-22 12:35:12 +01:00
Simon Larsen
42f0b90291 refactor: Update SendStatusChangeNotification to convert rootCause to HTML
This commit updates the SendStatusChangeNotification module to convert the rootCause property to HTML using the Markdown.convertToHTML function. This ensures that the rootCause is properly formatted for display in email notifications. The conversion is only performed if the rootCause is not empty. This improvement enhances the readability and presentation of the status change notifications.
2024-06-22 12:26:03 +01:00
Simon Larsen
3d4f28fc0f refactor: Simplify CodeRepositoryUtil.pullChanges method signature 2024-06-22 11:33:52 +01:00
snyk-bot
e74c6a7030 fix: upgrade posthog-js from 1.136.1 to 1.136.2
Snyk has created this PR to upgrade posthog-js from 1.136.1 to 1.136.2.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-21 19:17:11 +00:00
Simon Larsen
6be976102c refactor: Remove commented out code and unused imports 2024-06-21 18:53:11 +01:00
Simon Larsen
261072b1fd refactor: Update logging statements in CopilotActionService 2024-06-21 18:35:22 +01:00
Simon Larsen
e7659bdf08 chore: Switch to main branch before executing CopilotAction 2024-06-21 18:06:06 +01:00
Simon Larsen
2a8c45cea0 refactor: Improve page load performance with lazy loading for images 2024-06-21 18:04:09 +01:00
Simon Larsen
b197416247 Update OneUptime installation documentation and Docker Compose file
This commit updates the OneUptime installation documentation and Docker Compose file to provide clearer instructions for setting up and updating OneUptime. It includes steps for accessing OneUptime, setting up TLS/SSL certificates, and updating OneUptime using Git. The changes ensure that users have the necessary information to install and maintain OneUptime effectively.
2024-06-21 17:41:34 +01:00
Simon Larsen
fe0e745640 refactor: Update TLS/SSL certificate setup instructions 2024-06-21 17:39:05 +01:00
Simon Larsen
28ea4d9b83 refactor: Update TLS/SSL certificate setup instructions
This commit updates the installation documentation and example configuration file to provide clear instructions on setting up TLS/SSL certificates for OneUptime. It emphasizes that OneUptime does not support setting up SSL/TLS certificates and provides steps for using a reverse proxy like Nginx or Caddy, along with Let's Encrypt, to provision the certificates. It also includes instructions for updating the necessary settings in the configuration file. This improvement ensures that users have the necessary information to secure their OneUptime installation with SSL/TLS certificates.
2024-06-21 17:38:30 +01:00
Simon Larsen
3d7cb148d0 refactor: Update MonitorTable to use MonitorElement for rendering monitor names
This commit updates the MonitorTable component to use the MonitorElement component for rendering monitor names in the table. The MonitorElement component takes a Monitor object as a prop and renders the monitor name as a link. This change improves the modularity and reusability of the code by separating the rendering logic into a separate component.
2024-06-21 17:21:20 +01:00
Simon Larsen
0d0760e450 refactor: Update ServerMonitorCriteria to handle evaluateOverTime options
This commit updates the ServerMonitorCriteria class to handle the evaluateOverTime options in the criteria filter. If the evaluateOverTime flag is set to true and evaluateOverTimeOptions are provided, the offlineIfNotCheckedInMinutes value is updated accordingly. This enhancement improves the flexibility and customization of the ServerMonitorCriteria class.
2024-06-21 16:42:51 +01:00
Simon Larsen
a6f66a59bf refactor: Update sleep duration to 10 minutes for server startup 2024-06-21 16:11:16 +01:00
Simon Larsen
f09419ef50 refactor: Update failureCause message in PingMonitor.ts 2024-06-21 13:59:45 +01:00
Simon Larsen
4c90dc66a0 refactor: Update SendCreatedResourceNotification to convert rootCause to HTML 2024-06-21 13:56:23 +01:00
Simon Larsen
99c2e34ab5 refactor: Add support for IsOnline check in CriteriaFilterUtil 2024-06-21 13:43:29 +01:00
Simon Larsen
0fb0e9b047 refactor: Update SendCreatedResourceNotification to convert rootCause to HTML
This commit updates the SendCreatedResourceNotification class to convert the rootCause property to HTML using the Markdown.convertToHTML function. This ensures that the rootCause is properly formatted and displayed in the incident notification email. The rootCause is either the incident's rootCause or a default message if no rootCause is identified. This enhancement improves the readability and effectiveness of the incident notifications.
2024-06-21 13:34:00 +01:00
Simon Larsen
7ae6a3c5ea refactor: Update ProbeMonitorResponseService to include criteria details in rootCause
This commit updates the ProbeMonitorResponseService class to include the criteria details in the rootCause property of the ProbeApiIngestResponse. The criteria met ID, criteria name, criteria description, filter conditions met, and failure cause are now included in the rootCause. This enhancement improves the clarity and completeness of the rootCause information.
2024-06-21 13:08:05 +01:00
Simon Larsen
59f0526936 refactor: Update EvaluateOverTime method to handle boolean values for IsOnline metric
The EvaluateOverTime method in the EvaluateOverTime.ts file has been updated to handle boolean values for the IsOnline metric. This change allows the method to correctly evaluate and process the IsOnline metric data, improving the accuracy and reliability of the evaluation process.
2024-06-21 12:57:50 +01:00
Simon Larsen
bfcd5c1753 refactor: Improve clarity of CompareCriteria message generation
The CompareCriteria class has been refactored to improve the clarity of message generation. The code now checks the filter type before appending the values to the message, ensuring that the message is only generated when necessary. This change enhances the readability and maintainability of the code.
2024-06-21 12:31:43 +01:00
Simon Larsen
76df1a5889 refactor: Fix CriteriaFilterUtil to handle IsOnline check correctly
The CriteriaFilterUtil class has been updated to handle the IsOnline check correctly. The getEvaluateOverTimeTypeByCriteriaFilter method now includes the IsOnline check in the returned array of EvaluateOverTimeType values. This fix ensures that the CriteriaFilterUtil class functions properly and provides accurate results for the IsOnline check.
2024-06-21 12:24:06 +01:00
Simon Larsen
422ee6c192 refactor: Add support for IsOnline check in CriteriaFilterUtil
This commit adds support for the IsOnline check in the CriteriaFilterUtil class. The getEvaluateOverTimeTypeByCriteriaFilter method now includes the IsOnline check in the returned array of EvaluateOverTimeType values. This enhancement improves the functionality and flexibility of the CriteriaFilterUtil class.
2024-06-21 11:58:21 +01:00
Simon Larsen
808b3512f3 refactor: Improve clarity of declaredBy field assignment in SendCreatedResourceNotification.ts
This commit refactors the code in SendCreatedResourceNotification.ts to improve the clarity of how the "declaredBy" field is assigned. The code now checks if the incident has a createdByProbe and createdByUser, and assigns the appropriate value to "declaredBy" based on the available information. This change enhances the readability and maintainability of the code.
2024-06-21 11:44:19 +01:00
Simon Larsen
742796fd67 feat: Add declaredBy field to IncidentOwnerResourceCreated template and SendCreatedResourceNotification job
This commit adds the "declaredBy" field to the IncidentOwnerResourceCreated template in the Notification feature set and the SendCreatedResourceNotification job in the Workers feature set. The "declaredBy" field is used to display the name of the user or probe who declared the incident. This enhancement improves the clarity and completeness of the incident notifications sent to incident owners.
2024-06-21 11:39:32 +01:00
Simon Larsen
9027369e10 refactor: Add suffix to ProbeElement in Probe.tsx
This commit adds a new optional prop "suffix" to the ProbeElement component in Probe.tsx. The suffix is appended to the probe name displayed in the UI. This enhancement provides more flexibility in customizing the display of probe names.
2024-06-21 11:24:13 +01:00
Simon Larsen
a87f3ac896 refactor: Fix branch name generation in CopilotActionsBase.ts
The branch name generation in CopilotActionsBase.ts has been fixed to replace double hyphens with a single hyphen. This ensures that the branch name is correctly formatted and avoids any potential issues with branch creation and management.
2024-06-21 10:59:34 +01:00
Simon Larsen
db75cc1a5b Merge pull request #1499 from OneUptime/ai-copilot-main
Ai copilot main
2024-06-21 10:41:28 +01:00
Simon Larsen
2deeb32b78 refactor: Fix branch name generation in CopilotActionsBase.ts
The branch name generation in CopilotActionsBase.ts has been fixed to replace double hyphens with a single hyphen. This ensures that the branch name is correctly formatted and avoids any potential issues with branch creation and management.
2024-06-20 22:31:58 +01:00
Simon Larsen
bc8b8eb982 refactor: Update LlmType import paths in Copilot/Config.ts, Copilot/Service/LLM/Llama.ts, and Copilot/Service/LLM/LLM.ts
This commit updates the import paths for the LlmType module in the following files:
- Copilot/Config.ts
- Copilot/Service/LLM/Llama.ts
- Copilot/Service/LLM/LLM.ts

The import paths are corrected to match the actual file structure, ensuring that the LlmType module is properly imported and used throughout the codebase. This change improves the maintainability and readability of the code.
2024-06-20 21:37:24 +01:00
Simon Larsen
ef3fe66e72 Merge pull request #1498 from jackveney/patch-1
Update endpoint-status.sh to follow redirects
2024-06-20 21:10:32 +01:00
Jack Veney
17a0b65a4b Update endpoint-status.sh
Included the -L option in the curl command, ensuring that it will follow any 301 redirects until the final URL is reached.
2024-06-20 15:24:27 -04:00
Simon Larsen
01a1a0f69e Merge pull request #1496 from OneUptime/snyk-upgrade-99d49c023062d95b651963a884a19da7
[Snyk] Upgrade posthog-js from 1.135.2 to 1.136.1
2024-06-20 17:30:18 +01:00
Simon Larsen
1260e482cf refactor: Improve comments in code and update job function in app.py 2024-06-20 13:14:39 +01:00
Simon Larsen
6e5081a4e3 refactor: Remove unused CopilotEvent and CopilotEventService 2024-06-20 12:30:06 +01:00
Simon Larsen
dd93998296 refactor: Remove unused CopilotEvent and CopilotEventService
This commit removes the unused CopilotEvent enum and CopilotEventService class. These files are no longer needed in the codebase and can be safely deleted. Removing unused code improves the maintainability and reduces the complexity of the project.
2024-06-20 11:41:04 +01:00
Simon Larsen
94956b045a refactor: Improve comments in code and update job function in app.py
This commit refactors the code by improving the comments in the code and updating the job function in app.py. The comments are now focused on code that is hard to understand, and unnecessary comments are removed. The job function is converted to an async function to support asynchronous processing, which improves the performance and responsiveness of the application. These changes enhance the readability and efficiency of the codebase.
2024-06-20 10:00:07 +00:00
Simon Larsen
b2f650a865 refactor: Sanitize file path in CodeRepositoryUtil.getFileContent()
The file path in the CodeRepositoryUtil.getFileContent() method is now sanitized using the LocalFile.sanitizeFilePath() function before executing the command. This change ensures that the file path is properly formatted and prevents any potential security vulnerabilities or errors caused by invalid file paths.
2024-06-20 10:26:16 +01:00
Simon Larsen
4390a37184 fix prompt 2024-06-20 09:22:53 +00:00
Simon Larsen
9b08d1a9e4 refactor: Convert job function to async in app.py
The job function in app.py has been converted to an async function to support asynchronous processing. This change improves the performance and responsiveness of the application by allowing other tasks to run concurrently while the job function is processing the queue.
2024-06-19 21:05:36 +00:00
Simon Larsen
dbef1071e0 refactor: Add GPU support to Llama app in docker-compose.ai.yml 2024-06-19 20:58:08 +00:00
Simon Larsen
98fbbe301e refactor: Update variable types in Copilot/Init.ts and Copilot/Utils/Prompts.ts 2024-06-19 21:03:54 +01:00
snyk-bot
6805083725 fix: upgrade posthog-js from 1.135.2 to 1.136.1
Snyk has created this PR to upgrade posthog-js from 1.135.2 to 1.136.1.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-19 19:07:13 +00:00
Simon Larsen
27213fa235 refactor: Add FixNumberOfCodeEventsInEachRun constant to Config.ts
This commit adds the FixNumberOfCodeEventsInEachRun constant to the Config.ts file. The constant is set to 5 and is used to determine the number of code events to fix in each run. This change improves the flexibility and configurability of the code events handling in the application.
2024-06-19 16:29:25 +01:00
Simon Larsen
baa98e333e refactor: Update LlmType export in Config.ts and LlmType.ts 2024-06-19 15:36:24 +01:00
Simon Larsen
ccdcf2c679 refactor: Update Llama app to use local model path instead of model ID 2024-06-19 15:06:36 +01:00
Simon Larsen
85edd12c2d refactor: Update Dockerfile.tpl to use huggingface/transformers-pytorch-gpu image 2024-06-19 13:20:34 +00:00
Simon Larsen
97cc28b182 refactor: Update Dockerfile.tpl to use huggingface/transformers-pytorch-gpu image
This commit updates the Dockerfile.tpl to use the huggingface/transformers-pytorch-gpu image instead of the continuumio/anaconda3 image. This change allows the Llama app to utilize GPU resources for improved performance in AI processing. Additionally, the unnecessary installation of the transformers and accelerate libraries is removed as they are already included in the huggingface/transformers-pytorch-gpu image.
2024-06-19 13:06:23 +00:00
Simon Larsen
b0041e6993 refactor: Update Dockerfile.tpl to expose port 8547 instead of port 80 2024-06-19 12:18:25 +00:00
Simon Larsen
a66d78743d Merge pull request #1495 from im-alfa/bugfix/add-aero-as-a-valid-tld
fix: add `.aero` as a valid TLD
2024-06-19 12:48:38 +01:00
Simon Larsen
bc78491478 ```text
refactor: Add appname label to probe.yaml

This commit adds the "appname" label to the probe.yaml file in order to provide additional information about the application. This label will help with identifying the specific application when managing and monitoring the Kubernetes resources.
2024-06-19 11:14:33 +01:00
alfa
7751870ccf fix: add .aero as a valid TLD 2024-06-19 05:42:23 +02:00
Simon Larsen
df6ffb15d4 refactor: Add GPU support to Llama app in docker-compose.ai.yml
This commit adds GPU support to the Llama app in the docker-compose.ai.yml file. It includes a new deploy section with reservations for GPU devices, specifying the driver, count, and capabilities. This change enables the Llama app to utilize GPU resources for improved performance in AI processing.
2024-06-18 22:11:53 +01:00
Simon Larsen
df20f343e9 refactor: Update Llama app to log prompt and output to console
This commit updates the Llama app to log the prompt and output to the console for debugging purposes. It adds print statements to log the prompt before processing and the generated output after processing. This change improves the development workflow by providing visibility into the input and output of the AI model.
2024-06-18 22:08:42 +01:00
Simon Larsen
e4ade513ce feat: Add start-ai, build-ai, and force-build-ai scripts for AI services
This commit adds three new scripts, start-ai, build-ai, and force-build-ai, to the package.json file. These scripts are used to start, build, and force-build the AI services respectively. They are configured to export environment variables, run the prerun script, and execute the necessary docker compose commands with the specified configuration file. This addition enhances the development workflow by providing convenient commands for managing the AI services.
2024-06-18 21:49:00 +01:00
Simon Larsen
3c2af1dc38 refactor: Remove unused Llama service from docker-compose.dev.yml 2024-06-18 21:47:40 +01:00
Simon Larsen
af5d714642 refactor: Add generate-build-number job as dependency in infrastructure-agent-deploy workflow 2024-06-18 21:41:57 +01:00
Simon Larsen
3f315be279 refactor: Update Llama app to use local model path instead of model ID
This commit updates the Llama app to use a local model path instead of a model ID. The model path is set to "/app/Models/Meta-Llama-3-8B-Instruct". This change improves the reliability and performance of the app by directly referencing the model file instead of relying on an external model ID.
2024-06-18 21:41:29 +01:00
Simon Larsen
095493cec9 Merge branch 'release' into ai-copilot-main 2024-06-18 19:29:03 +01:00
Simon Larsen
3bdf87f34f refactor: Update github-release workflow to include generate-build-number job
This commit modifies the github-release workflow to include the generate-build-number job as a dependency. Previously, the workflow only depended on the test-e2e-release-saas and test-e2e-release-self-hosted jobs. By adding the generate-build-number job, we ensure that the necessary build number is generated before the github-release job is executed. This change improves the overall release process by providing accurate build information for the release.
2024-06-18 19:02:46 +01:00
Simon Larsen
26bb6f1e74 refactor: Update Dockerfile.tpl to expose port 8547 instead of port 80
This commit modifies the Dockerfile.tpl file to update the EXPOSE directive. The port number is changed from 80 to 8547 to align with the port used by the Llama application. This change ensures that the Llama application is accessible from outside the container on the correct port.
2024-06-18 18:42:11 +01:00
Simon Larsen
20db81a5f6 refactor: Update secrets.yaml to add keys for postgres, redis, and clickhouse
This commit modifies the secrets.yaml file to add keys for postgres, redis, and clickhouse. These keys are used to store sensitive information such as passwords for external services. By including these keys, we ensure that the necessary secrets are available for the application to connect to these services securely.
2024-06-18 13:59:49 +01:00
Simon Larsen
f9b097a112 refactor: Improve page load performance by lazy loading images
This commit updates the Register.spec.ts file to improve the page load performance by implementing lazy loading for images. It ensures that the dashboard page is up before signing up the user and reloads the page if it fails to load. These changes enhance the user experience by optimizing the loading time of the registration page.
2024-06-18 13:45:51 +01:00
Simon Larsen
b70b70e27e Merge remote-tracking branch 'origin/snyk-upgrade-e85a20baed82dca9b23b1e6d43058393' 2024-06-18 13:35:13 +01:00
Simon Larsen
93df459662 Merge pull request #1487 from OneUptime/snyk-upgrade-07f6caf2da548bfa468d50536046a7d4
[Snyk] Upgrade playwright from 1.44.0 to 1.44.1
2024-06-18 13:34:00 +01:00
Simon Larsen
1aceb81c85 Merge pull request #1490 from OneUptime/snyk-upgrade-3e8efba0b61bba9ccdff4fbf1899abe8
[Snyk] Upgrade posthog-js from 1.133.0 to 1.135.2
2024-06-18 13:33:53 +01:00
Simon Larsen
023aea94c2 Merge pull request #1491 from OneUptime/snyk-upgrade-172a12f064e961ffc3354f68f2eb7cb7
[Snyk] Upgrade @babel/runtime from 7.24.5 to 7.24.6
2024-06-18 13:33:46 +01:00
Simon Larsen
d8dff468ab refactor: Update Cookie.ts to accept string as key parameter
This commit modifies the Cookie.ts file to update the setItem method signature. The key parameter now accepts both CookieName and string types, allowing for more flexibility when setting cookies. This change improves the usability and versatility of the Cookie utility class.
2024-06-18 13:33:09 +01:00
Simon Larsen
082d800c34 refactor: Update ProbeMonitorResponseService to include remediation notes
This commit updates the ProbeMonitorResponseService class to include a check for the presence of remediation notes in the criteriaIncident object. If remediation notes are provided, they are assigned to the incident object. This change enhances the functionality of the ProbeMonitorResponseService by allowing the storage and retrieval of remediation notes for incidents.
2024-06-18 13:08:56 +01:00
Simon Larsen
e7f4c962b8 refactor: Update incident form to include remediation notes
This commit updates the incident form to include a field for remediation notes. This allows users to provide specific steps that should be taken to resolve the incident. By adding this feature, we enhance the incident management process and improve collaboration among team members.
2024-06-18 13:07:59 +01:00
Simon Larsen
f6074fe8f4 refactor: Update MonitorCriteriaIncident component to remove unused imports 2024-06-18 13:00:10 +01:00
Simon Larsen
b45678f167 refactor: Update MonitorCriteriaIncidentForm UI with incident description and remediation notes
This commit updates the MonitorCriteriaIncidentForm component to include fields for incident description and remediation notes. The incident description field now supports markdown formatting and has a placeholder text for when no description is entered. Similarly, the remediation notes field also supports markdown formatting and has a placeholder text for when no notes are entered. These changes enhance the user experience by providing a more comprehensive incident form.
2024-06-18 12:59:22 +01:00
Simon Larsen
6d53678135 refactor: Add new migration for SchemaMigrations and update MonitorCriteriaIncidentForm UI 2024-06-18 12:56:12 +01:00
Simon Larsen
7b77dd4a53 refactor: Add new migration for SchemaMigrations and update MonitorCriteriaIncidentForm UI
This commit adds a new migration file for the SchemaMigrations table, introducing a new migration named MigrationName1718711669847. This migration is imported in the Index.ts file of the SchemaMigrations directory. Additionally, the MonitorCriteriaIncidentForm component is updated to change the title of the "Show Advanced Fields" button to "Add Remediation Notes for an engineer to help resolve this incident." The button is also given a left margin of -3 pixels to adjust its positioning. These changes improve the database schema management and enhance the user experience in the incident form.
2024-06-18 12:55:52 +01:00
Simon Larsen
51bb54e771 refactor: Add placeholder text for name and email fields in user profile form 2024-06-18 12:51:17 +01:00
Simon Larsen
48b095f548 refactor: Update import statements for TimezoneUtil in multiple files 2024-06-18 12:44:54 +01:00
Simon Larsen
786ec6ce7a refactor: Update import statements for TimezoneUtil in multiple files 2024-06-18 11:35:04 +01:00
Simon Larsen
401fbb58e3 refactor: Update import statements for TimezoneUtil in multiple files 2024-06-18 10:38:45 +01:00
Simon Larsen
5243ae6b8d Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-18 10:05:03 +01:00
Simon Larsen
a06a0f1d16 refactor: Update import statements for TimezoneUtil in multiple files 2024-06-17 21:01:44 +01:00
Simon Larsen
e0bc906484 Merge pull request #1489 from hg13bs/patch-1
Remove duplicate "Swift" entry
2024-06-17 19:29:01 +01:00
Simon Larsen
139ff2d638 refactor: Add user timezone support to login and user profile
This commit adds support for user timezones in the login and user profile functionality. It updates the LoginUtil and User classes to include methods for setting and retrieving the user's timezone. Additionally, the UserTimezoneInit component in the Dashboard module is updated to display and allow the user to update their timezone. This change improves the user experience by providing accurate timezone information and allows for better handling of time-related functionality throughout the application.
2024-06-17 17:27:34 +01:00
Simon Larsen
7be603ef08 refactor: Update import statements for TimezoneUtil in multiple files 2024-06-17 17:22:00 +01:00
Simon Larsen
d23548f984 refactor: Update error message in OneUptimeDate class
This commit updates the error message in the `asDateForDatabaseQuery` method of the `OneUptimeDate` class. It now includes the `date.toString()` value to provide more information about the invalid date. This change improves error handling and debugging capabilities.
2024-06-17 17:09:17 +01:00
Simon Larsen
3573e59634 refactor: Update getCurrentTimezoneString method in Date.ts
This commit refactors the getCurrentTimezoneString method in the Date.ts file. It replaces the usage of moment.tz.guess() with this.getCurrentTimezone() to improve code readability and maintainability. Additionally, it adds a check to prepend "GMT" to the zone abbreviation if it starts with a "+" or "-" sign. This change ensures consistent formatting of the timezone string returned by the method.
2024-06-17 16:23:49 +01:00
Simon Larsen
c4e4e7e488 refactor: Update import statements for TimezoneUtil in Monitor.ts
This commit updates the import statements in the Monitor.ts file. It changes the import statement for the TimezoneUtil module to import from "Common/Types/Timezone" instead of the previous import path. This change ensures that the correct module is imported, improving the accuracy and reliability of the code.
2024-06-17 16:14:08 +01:00
Simon Larsen
be3e8447ab refactor: Add data-testid attributes to Toast component
This commit adds data-testid attributes to the Toast component in order to improve testability. The "toast" element, "toast-icon" element, "title" element, "description" element, and "close-button" element now have corresponding data-testid attributes. This change allows for more precise targeting of elements in automated tests, enhancing the reliability and accuracy of the test suite.
2024-06-17 16:07:04 +01:00
Simon Larsen
2615e39c19 refactor: Update import statements for TimezoneUtil in multiple files 2024-06-17 15:58:30 +01:00
Simon Larsen
49b6550581 refactor: Update import statements for TimezoneUtil in UserProfile/Index.tsx 2024-06-17 15:57:32 +01:00
Simon Larsen
e870efc3c4 refactor: Remove unused code and update import statements 2024-06-17 15:33:47 +01:00
Simon Larsen
38862adf5a refactor: Remove unused code and update import statements
This commit removes unused code and updates import statements in multiple files. It removes the unused TimezoneCode enum from the Common/Types/TimezoneCode.ts file and updates the import statements in the affected files to import Timezone from Common/Types/Timezone instead of TimezoneCode. These changes improve the accuracy and reliability of the code.
2024-06-17 13:43:09 +01:00
Simon Larsen
06b92e2745 feat: Add subscriber timezones functionality to SubscriberSettings 2024-06-17 13:18:44 +01:00
Simon Larsen
1a8e0682c7 feat: Add subscriber timezones functionality to SubscriberSettings
This commit adds the functionality to select subscriber timezones in the SubscriberSettings component. It introduces a new field, "Subscriber Timezones", which allows subscribers to choose their preferred timezones for receiving notifications. The selected timezones are displayed when subscribers receive notifications. This feature enhances the user experience by providing localized time information.

Refactor import statements for TimezoneUtil in UserProfile/Index.tsx

This commit updates the import statements in the UserProfile/Index.tsx file to import TimezoneUtil from "Common/Types/Timezone" instead of "CommonUI/src/Utils/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.

Refactor import statements for TimezoneUtil in UserProfile/Index.tsx

This commit updates the import statements in the UserProfile/Index.tsx file to import TimezoneUtil from "Common/Types/Timezone" instead of "CommonUI/src/Utils/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.

Refactor import statements for TimezoneUtil in UserProfile/Index.tsx

This commit updates the import statements in the UserProfile/Index.tsx file to import TimezoneUtil from "Common/Types/Timezone" instead of "CommonUI/src/Utils/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.

Refactor import statements for TimezoneUtil in UserProfile/Index.tsx

This commit updates the import statements in the UserProfile/Index.tsx file to import TimezoneUtil from "Common/Types/Timezone" instead of "CommonUI/src/Utils/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.

refactor: Update retries value in playwright.config.ts

This commit updates the retries value in the playwright.config.ts file to a fixed value of 3. This change ensures that the tests are retried up to 3 times, improving the reliability of the test suite.

refactor: Update import statements for jest in test files

This commit updates the import statements for jest in multiple test files to use the correct module name "jest" instead of "globals". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.

refactor: Update docker-compose command in test.e2e.yaml

This commit updates the docker-compose command in the test.e2e.yaml file to remove the duplicate `e2e` service name. This change improves the clarity and efficiency of the script.

fix: job dependencies

Merge branch 'release' of github.com:OneUptime/oneuptime into release

refactor: Clear user data and remove cookies on authentication error
2024-06-17 11:03:37 +01:00
Simon Larsen
e0189356d5 refactor: Remove TimezoneCode enum and update import statements
This commit removes the TimezoneCode enum from the Common/Types/TimezoneCode.ts file. The enum is no longer needed and can be safely deleted. Additionally, it updates the import statements in the affected files to import Timezone from Common/Types/Timezone instead of TimezoneCode. This change ensures that the correct module is imported and improves the accuracy and reliability of the code.
2024-06-17 10:56:59 +01:00
Simon Larsen
dad07b9f80 refactor: Update import statements for TimezoneUtil in UserProfile/Index.tsx
This commit updates the import statements in the UserProfile/Index.tsx file. It changes the import statement for TimezoneUtil from "CommonUI/src/Utils/Timezone" to "Common/Types/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.
2024-06-17 10:47:23 +01:00
Simon Larsen
8d59710306 refactor: Update import statements for TimezoneUtil in UserProfile/Index.tsx
This commit updates the import statements in the UserProfile/Index.tsx file. It changes the import statement for TimezoneUtil from "CommonUI/src/Utils/Timezone" to "Common/Types/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.
2024-06-17 10:42:43 +01:00
Simon Larsen
5e9227eb4f refactor: Add TimezoneUtil to UserProfile/Index.tsx
This commit refactors the import statements in the UserProfile/Index.tsx file. It updates the import statement for TimezoneUtil from "CommonUI/src/Utils/Timezone" to "Common/Types/Timezone". This change ensures that the correct module is imported, improving the accuracy and reliability of the code.
2024-06-17 10:41:04 +01:00
snyk-bot
1e63173564 fix: upgrade @babel/runtime from 7.24.5 to 7.24.6
Snyk has created this PR to upgrade @babel/runtime from 7.24.5 to 7.24.6.

See this package in npm:
@babel/runtime

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-15 06:14:37 +00:00
snyk-bot
76fded39ee fix: upgrade posthog-js from 1.133.0 to 1.135.2
Snyk has created this PR to upgrade posthog-js from 1.133.0 to 1.135.2.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-15 06:12:15 +00:00
hg13
c82f3c1f71 Remove duplicate "Swift" entry 2024-06-15 02:06:24 +03:00
Simon Larsen
24d9219a62 refactor: Update retries value in playwright.config.ts
This commit updates the retries value in the playwright.config.ts file. The previous value was determined based on the environment variable "CI", but it has been changed to a fixed value of 3. This change ensures that the tests are retried up to 3 times, improving the reliability of the test suite.
2024-06-14 19:38:03 +01:00
Simon Larsen
6ed588d7aa refactor: Update import statements for jest in test files
This commit updates the import statements for jest in multiple test files. The previous import statements used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 18:54:53 +01:00
Simon Larsen
17c1862eac ```text
refactor: Update docker-compose command in test.e2e.yaml

This commit updates the docker-compose command in the test.e2e.yaml file. The previous command included the `e2e` service name twice, which is unnecessary. The updated command removes the duplicate service name, improving the clarity and efficiency of the script.
2024-06-14 18:34:11 +01:00
Simon Larsen
37b1846363 fix job dependencies 2024-06-14 18:21:51 +01:00
Simon Larsen
da3e6bc3af Merge branch 'release' of github.com:OneUptime/oneuptime into release 2024-06-14 18:02:55 +01:00
Simon Larsen
a35ea2ba66 refactor: Clear user data and remove cookies on authentication error 2024-06-14 18:02:36 +01:00
Simon Larsen
b2fa2e40f4 refactor: Clear user data and remove cookies on authentication error
This commit clears the user data and removes cookies when an authentication error occurs. This ensures that the user is logged out and any stored data is removed, preventing unauthorized access. The code change is made in the API.ts file.
2024-06-14 18:01:51 +01:00
Simon Larsen
babecb5170 chore: Update axios and posthog-js dependencies
This commit updates the axios and posthog-js dependencies in the package-lock.json file. The axios dependency is updated from version 1.7.1 to 1.7.2, and the posthog-js dependency is updated from version 1.131.4 to 1.133.0. This update ensures that the latest stable versions of these dependencies are used, improving the functionality and security of the application.
2024-06-14 17:35:33 +01:00
Simon Larsen
6e0e643337 refactor: Update import statements for jest in test files
This commit updates the import statements for jest in multiple test files. The previous import statements used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 17:01:06 +01:00
Simon Larsen
2a59faa6b4 refactor: Update import statements for jest in test files
This commit updates the import statements for jest in multiple test files. The previous import statements used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 16:54:53 +01:00
Simon Larsen
9d7d44afda refactor: Update import statements for jest in test files
This commit updates the import statements for jest in multiple test files. The previous import statements used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 16:42:55 +01:00
Simon Larsen
8f1e67da3a refactor: Remove ignore for all JavaScript files in eslint configuration 2024-06-14 15:44:31 +01:00
Simon Larsen
c09f863d58 refactor: Remove unused imports and update eslint configuration 2024-06-14 15:42:45 +01:00
Simon Larsen
3c8c2a3feb refactor: Update import statements for jest in test files
This commit updates the import statements for jest in multiple test files. The previous import statements used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 15:42:33 +01:00
Simon Larsen
4c4169e245 refactor: Update import statements for jest in test files 2024-06-14 14:24:45 +01:00
Simon Larsen
34c5cb1e94 refactor: Update import statements for jest in test files 2024-06-14 14:20:24 +01:00
Simon Larsen
f5fca46e5b refactor: Update import statements for jest in test files
This commit updates the import statements for jest in multiple test files. The previous import statements used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 14:16:56 +01:00
Simon Larsen
48e3c24c6e refactor: Update import statement for jest in setupTest.js
This commit updates the import statement for jest in the setupTest.js file. The previous import statement used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 14:11:32 +01:00
Simon Larsen
e9c94876c0 refactor: Update import statement for jest in setupTest.js
This commit updates the import statement for jest in the setupTest.js file. The previous import statement used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 14:06:41 +01:00
Simon Larsen
fcd6c8ea7d refactor: Remove unused imports and update eslint configuration 2024-06-14 13:50:52 +01:00
Simon Larsen
81726ce7b2 refactor: Update import statement for jest in setupTest.js 2024-06-14 13:40:33 +01:00
Simon Larsen
6349c60bdb refactor: Update import statement for jest in setupTest.js
This commit updates the import statement for jest in the setupTest.js file. The previous import statement used "globals" as the module name, which is incorrect. The correct module name is "jest". This change ensures that the jest module is imported correctly, improving the accuracy and reliability of the test setup.
2024-06-14 13:01:38 +01:00
Simon Larsen
74cf119444 refactor: Remove unused globals.jquery from eslint configuration 2024-06-14 12:36:11 +01:00
Simon Larsen
ba6ac2e32e refactor: Update symbol type to use lowercase 'symbol' in ColumnAccessControl files 2024-06-14 12:34:56 +01:00
Simon Larsen
1498656a43 refactor: Update symbol type to use lowercase 'symbol' in ColumnAccessControl files 2024-06-14 12:15:36 +01:00
Simon Larsen
70a2a3993b refactor: Update symbol type to use lowercase 'symbol' in ColumnAccessControl files 2024-06-14 12:09:53 +01:00
Simon Larsen
5152d5de12 refactor: Remove @trivago/prettier-plugin-sort-imports and update eslint configuration
This commit removes the "@trivago/prettier-plugin-sort-imports" plugin from the ".prettierrc.json" file and updates the eslint configuration in the "package.json" file. The plugin was removed because it is no longer needed and caused conflicts with the updated eslint configuration. This change improves the codebase by simplifying the prettier configuration and ensuring compatibility with the updated eslint rules.
2024-06-14 12:07:16 +01:00
Simon Larsen
2999e539b3 refactor: Update symbol type to use lowercase 'symbol' in ColumnAccessControl files 2024-06-14 12:01:14 +01:00
Simon Larsen
8ce432256c refactor: Update symbol type to use lowercase 'symbol' in ColumnAccessControl files
This commit updates the symbol type from 'Symbol' to 'symbol' in the ColumnAccessControl files. The use of 'symbol' aligns with the TypeScript convention for symbol types. This change improves code consistency and readability.
2024-06-14 11:53:27 +01:00
Simon Larsen
ddbfbac802 refactor: Remove unused files and update eslint configuration 2024-06-14 11:51:38 +01:00
Simon Larsen
1d6a7ee1fa feat: Add timezone dropdown to user profile page
This commit adds a new dropdown component for selecting the timezone on the user profile page. The dropdown options are populated using the `TimezoneCode` enum from the `Common/Types/TimezoneCode.ts` file. Users can now select their timezone, which will be used for all date and time related notifications sent to them. This enhancement improves the user experience by providing a convenient way to set the timezone preference.
2024-06-14 11:21:25 +01:00
Simon Larsen
0d97f0447a refactor: Improve error handling in API class
This commit refactors the API class in API.ts to improve error handling. The `getFriendlyErrorMessage` method now includes additional error cases and returns more specific error messages for network errors, timeouts, request aborts, cancellations, connection issues, and SSL certificate expiration. This change enhances the user experience by providing clearer and more informative error messages.
2024-06-14 10:57:19 +01:00
Simon Larsen
36a13b60fe refactor: Update notification subjects for incidents and announcements 2024-06-14 10:20:57 +01:00
Simon Larsen
64f4fcf829 refactor: Update notification subjects for incidents and announcements 2024-06-14 10:06:38 +01:00
Simon Larsen
1ff7c84d82 refactor: Update notification subjects for incidents and announcements
This commit updates the notification subjects for incidents and announcements in the SendNotificationToSubscribers.ts files. The subjects now include a prefix indicating the type of notification (e.g., [Incident], [Announcement]) followed by the status page name. This change improves the clarity and consistency of the notification emails and SMS messages sent to subscribers.
2024-06-14 10:05:48 +01:00
Simon Larsen
da623d4d34 increase timeout 2024-06-14 10:00:03 +01:00
snyk-bot
2efb630640 fix: upgrade playwright from 1.44.0 to 1.44.1
Snyk has created this PR to upgrade playwright from 1.44.0 to 1.44.1.

See this package in npm:
playwright

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/49c81d9c-12c2-4e8e-b9e8-72f98b1b595c?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-14 05:19:10 +00:00
Simon Larsen
affa492ce3 refactor: Improve SSL certificate error handling
This commit refactors the API class in API.ts to improve the handling of SSL certificate errors. The `getFriendlyErrorMessage` method now includes specific error messages for different SSL certificate issues, such as expired certificates, certificates signed by unknown authorities, and self-signed certificates. This enhancement enhances the user experience by providing clearer and more informative error messages for SSL certificate errors.
2024-06-13 21:50:59 +01:00
Simon Larsen
5ae3a5b5ee refactor: Improve error handling in API class
The API class in API.ts has been updated to improve error handling. The getFriendlyErrorMessage method now includes additional error cases and returns more specific error messages for network errors, timeouts, request aborts, cancellations, connection issues, and SSL certificate expiration. This change enhances the user experience by providing clearer and more informative error messages.
2024-06-13 21:50:10 +01:00
Simon Larsen
5716ab2445 refactor: Update API error handling and display
The API class in API.ts has been updated to improve error handling and display. The getFriendlyErrorMessage method now includes additional error cases and returns more specific error messages for network errors, timeouts, request aborts, cancellations, connection issues, and SSL certificate expiration. This change enhances the user experience by providing clearer and more informative error messages.
2024-06-13 21:45:56 +01:00
Simon Larsen
a66a04456b refactor: Update endpoint URLs for status check script 2024-06-13 21:44:49 +01:00
Simon Larsen
e97a78eaeb Merge branch 'ai-copilot-main' 2024-06-13 21:12:48 +01:00
Simon Larsen
57f41a908a refactor: Improve login test to handle missing user credentials 2024-06-13 21:11:54 +01:00
Simon Larsen
f42291a428 refactor: Update status check URLs for Dashboard, Status Page, and Accounts
The status-check.sh script has been modified to update the endpoint URLs for checking the status of the Dashboard, Status Page, and Accounts services. The URLs now include "/status/ready" at the end, ensuring that the services are ready to handle requests. This change improves the accuracy and reliability of the status check script.
2024-06-13 21:05:37 +01:00
Simon Larsen
4fa9adfc7d refactor: Update login test to handle missing user credentials
The login test in Login.spec.ts has been updated to handle cases where the user credentials (email and password) are missing. Previously, the test would only check if the user is registered, but now it also checks if the registered user email and password are available. This change ensures that the test behaves correctly in all scenarios and improves the reliability of the login functionality.
2024-06-13 18:49:19 +01:00
Simon Larsen
3e2e581e52 ```text
refactor: Update artifact upload paths in release and test workflows

The artifact upload paths in the release.yml, test-release.yaml, and test.e2e.yaml workflows have been updated to include the entire E2E directory instead of specific subdirectories. This change simplifies the configuration and ensures that all necessary files are included in the artifacts.
2024-06-13 18:39:02 +01:00
Simon Larsen
2a3c34af95 refactor: Add endpoint to retrieve Copilot events by file
This commit adds a new endpoint to the CodeRepositoryAPI class in CodeRepositoryAPI.ts. The endpoint allows users to retrieve Copilot events for a specific file in the code repository. It takes in a secret key, file path, and service catalog ID as parameters and returns a list of Copilot events. This enhancement improves the functionality and usability of the API.
2024-06-13 14:55:31 +01:00
Simon Larsen
170b79e4cf refactor: Add CopilotEventStatus column to CopilotEvent model
This commit adds a new column, CopilotEventStatus, to the CopilotEvent model in the CopilotEvent.ts file. The CopilotEventStatus column represents the status of a Copilot event that was triggered for a file in the code repository. This enhancement improves the functionality and flexibility of the CopilotEvent model.
2024-06-13 14:39:26 +01:00
Simon Larsen
c15b8bb951 refactor: Update CodeRepositoryUtil to include serviceRepository parameter in createBranch and createOrCheckoutBranch 2024-06-13 14:11:09 +01:00
Simon Larsen
17c47f7d89 refactor: Update ServiceFileTypesUtil to include common directories and files to ignore 2024-06-13 13:32:16 +01:00
Simon Larsen
a406287215 refactor: Update branch name in Copilot/Index.ts and add GITHUB_USERNAME to .env.example
This commit updates the branch name in Copilot/Index.ts from 'test-branch-3' to 'test-branch-4'. Additionally, it adds the GITHUB_USERNAME variable to the .env.example file. These changes improve the accuracy and functionality of the code.
2024-06-13 13:10:14 +01:00
Simon Larsen
a73b050a4d refactor: Update CodeRepositoryUtil to include serviceRepository parameter in createBranch and createOrCheckoutBranch
This commit modifies the CodeRepositoryUtil class in CodeRepository.ts to include a new parameter, serviceRepository, in the createBranch and createOrCheckoutBranch methods. This change allows for better integration with the ServiceRepository class and improves the flexibility and maintainability of the code.
2024-06-13 12:47:42 +01:00
Simon Larsen
224fb2e887 Merge pull request #1479 from OneUptime/snyk-upgrade-fb48859c6d1e1f5c6c32c4f5abf203c1
[Snyk] Upgrade posthog-js from 1.132.0 to 1.133.0
2024-06-13 12:34:04 +01:00
Simon Larsen
96d4131614 refactor: Add createPullRequest method to HostedCodeRepository
The HostedCodeRepository class in HostedCodeRepository.ts has been updated to include a new method, createPullRequest. This method allows for the creation of pull requests in the code repository. This change enhances the functionality and flexibility of the HostedCodeRepository class.
2024-06-13 12:26:49 +01:00
snyk-bot
cda00d5238 fix: upgrade posthog-js from 1.132.0 to 1.133.0
Snyk has created this PR to upgrade posthog-js from 1.132.0 to 1.133.0.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-13 00:27:42 +00:00
Simon Larsen
dea385ad44 refactor: Update ServiceFileTypesUtil to include common directories and files to ignore
The ServiceFileTypesUtil class in ServiceFileTypes.ts has been updated to include two new methods: getCommonDirectoriesToIgnore and getCommonFilesToIgnore. These methods return arrays of common directories and files that should be ignored in code repositories. This change improves the functionality and maintainability of the code by providing a centralized way to define and retrieve the directories and files to ignore.
2024-06-12 22:10:47 +01:00
Simon Larsen
21973401fb refactor: Improve file extension handling in CodeRepositoryUtil
The CodeRepositoryUtil class in CodeRepository.ts has been refactored to improve the handling of file extensions. The changes include:
- Simplifying the logic for skipping files with unsupported extensions
- Adding support for accepted file extensions in the getFilesInDirectory method

These improvements enhance the functionality and maintainability of the code.
2024-06-12 22:07:01 +01:00
Simon Larsen
d153ad9bf7 refactor: Update ServiceRepository to include serviceLanguage field
The ServiceRepository class in ServiceRepository.ts has been updated to include a new field, serviceLanguage. This field is of type ServiceLanguage and is required. This change allows for better organization and identification of code repositories based on their programming language.
2024-06-12 21:27:00 +01:00
Simon Larsen
2ce8ba6295 refactor: Sanitize file paths in CodeRepositoryUtil and LocalFile
This commit refactors the CodeRepositoryUtil and LocalFile classes to include a new method, sanitizeFilePath, which removes double slashes from file paths. This change ensures that file paths are properly formatted and improves the reliability and maintainability of the code.
2024-06-12 21:05:37 +01:00
Simon Larsen
572130d349 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-12 20:21:07 +01:00
Simon Larsen
f0cb049266 refactor: Update CodeRepositoryView component in Index.tsx
The CodeRepositoryView component in Index.tsx has been updated to include a new field for the repository name. This change allows for better organization and identification of code repositories within the system.
2024-06-12 20:20:40 +01:00
Simon Larsen
cab5af6645 refactor: Add organizationName and repositoryName fields to CodeRepository
The CodeRepository entity has been updated to include two new fields: organizationName and repositoryName. These fields are of type character varying(100) and are required. This change allows for better organization and identification of code repositories within the system.
2024-06-12 20:18:30 +01:00
Simon Larsen
e77b923dc1 Merge pull request #1472 from OneUptime/ai-copilot-main
Copilot Main
2024-06-12 19:20:49 +01:00
Simon Larsen
8325c06ca3 refactor: Update status check URLs for Dashboard and Status Page
The status-check.sh script has been modified to update the endpoint URLs for checking the status of the Dashboard and Status Page services. The URLs now include "/status/ready" at the end, ensuring that the services are ready to handle requests. This change improves the accuracy and reliability of the status check script.
2024-06-12 17:27:22 +01:00
Simon Larsen
b66f56bc12 refactor: Update endpoint status check URLs to include "/ready"
The status-check.sh script has been updated to modify the endpoint URLs for checking the status of various services. The URLs now include "/ready" at the end, indicating that the services are ready to handle requests. This change ensures that the status check accurately reflects the readiness of the services and improves the reliability of the script.
2024-06-12 17:25:08 +01:00
Simon Larsen
2de2926d79 refactor: Add MigrationName1718203144945 to SchemaMigrations/Index.ts
The SchemaMigrations/Index.ts file has been updated to include the MigrationName1718203144945 migration. This change ensures that the new migration is included in the list of schema migrations, allowing for proper database versioning and management.
2024-06-12 15:39:55 +01:00
Simon Larsen
fd13e91aac refactor: Update ServiceRepository to use number type for limitNumberOfOpenPullRequestsCount
The ServiceRepository class in ServiceRepository.ts has been updated to use the number type for the limitNumberOfOpenPullRequestsCount property instead of the string type. This change ensures that the property is correctly typed and improves the accuracy and reliability of the code.
2024-06-12 15:38:54 +01:00
Simon Larsen
cf7d4c7720 refactor: Update GitHubUtil to use HostedCodeRepository/HostedCodeRepository 2024-06-12 15:11:50 +01:00
Simon Larsen
b1a76e97ce Merge pull request #1477 from OneUptime/snyk-upgrade-4dc39844f330c9a5f3d5be2668e24709
[Snyk] Upgrade axios from 1.7.0 to 1.7.2
2024-06-12 14:19:29 +01:00
Simon Larsen
7d8036e3eb refactor: Update GitHubUtil to use HostedCodeRepository/HostedCodeRepository
The GitHubUtil class in GitHub.ts has been updated to import the HostedCodeRepository class from the correct file path, "HostedCodeRepository/HostedCodeRepository". This change ensures that the correct class is imported and used, improving the functionality and maintainability of the code.
2024-06-12 13:18:20 +01:00
Simon Larsen
c7344a7624 refactor: Remove commented out code and unused imports
The CodeRepositoryType.ts file has been refactored to remove commented out code and unused imports. This change improves code cleanliness and reduces unnecessary clutter in the file.
2024-06-12 12:25:12 +01:00
Simon Larsen
42253e4e50 refactor: Update GitHub token handling in Config.ts 2024-06-12 11:59:22 +01:00
Simon Larsen
64acf372d6 refactor: Update GitHub token handling in Config.ts
The Config.ts file has been updated to handle the GitHub token more efficiently. The GetGitHubToken function now checks the repository type and throws an exception if a GitHub token is required but not provided. This change improves the security and reliability of the application by ensuring that the correct token is used for GitHub repositories.
2024-06-12 11:31:50 +01:00
snyk-bot
80f4238618 fix: upgrade axios from 1.7.0 to 1.7.2
Snyk has created this PR to upgrade axios from 1.7.0 to 1.7.2.

See this package in npm:
axios

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/49c81d9c-12c2-4e8e-b9e8-72f98b1b595c?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-12 04:53:12 +00:00
Simon Larsen
2fe54c46c1 Merge pull request #1475 from OneUptime/snyk-upgrade-d4dca93f2a1a1e81fe41908a5a826632
[Snyk] Upgrade posthog-js from 1.131.4 to 1.132.0
2024-06-11 19:55:56 +01:00
Simon Larsen
266b046b9e Merge pull request #1474 from OneUptime/snyk-upgrade-8df461c2c34dd57552a05c7122331e04
[Snyk] Upgrade axios from 1.7.1 to 1.7.2
2024-06-11 19:55:45 +01:00
snyk-bot
f311841df2 fix: upgrade posthog-js from 1.131.4 to 1.132.0
Snyk has created this PR to upgrade posthog-js from 1.131.4 to 1.132.0.

See this package in npm:
posthog-js

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-11 18:09:12 +00:00
snyk-bot
26319ff3c8 fix: upgrade axios from 1.7.1 to 1.7.2
Snyk has created this PR to upgrade axios from 1.7.1 to 1.7.2.

See this package in npm:
axios

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-11 18:09:07 +00:00
Simon Larsen
e719bb3b70 refactor: Add doNotShowWhenEditing flag to ServiceRepositoryPage component
The ServiceRepositoryPage component has been updated to include a new flag, doNotShowWhenEditing, which controls whether a certain field should be displayed when editing a service. This change improves the user experience by allowing for more flexibility in customizing the form fields based on the editing mode.
2024-06-11 18:38:37 +01:00
Simon Larsen
d0255c1e33 feat: Enable editing of services in ServiceRepositoryPage 2024-06-11 18:37:49 +01:00
Simon Larsen
f66241d12f Merge pull request #1473 from OneUptime/master
Release
2024-06-11 18:36:34 +01:00
Simon Larsen
52f4c74908 refactor: Update noItemsMessage prop types to include ReactElement
The prop types for the noItemsMessage prop have been updated in multiple components to include the ReactElement type. This change allows for passing React elements as the no items message, providing more flexibility in customizing the message's content and appearance.
2024-06-11 18:34:25 +01:00
Simon Larsen
eeb6904c2d refactor: Update title of Service Catalog field in ServiceRepositoryPage
The title of the Service Catalog field in the ServiceRepositoryPage component has been updated from "Service Catalog" to "Service". This change improves clarity and consistency in the user interface.
2024-06-11 18:31:10 +01:00
Simon Larsen
6fd37c62b8 refactor: Add MigrationName1718126316684 to SchemaMigrations/Index.ts
This commit adds the MigrationName1718126316684 to the list of schema migrations in the Index.ts file. The new migration introduces changes to the database schema and ensures that the codebase is up to date with the latest schema changes. This enhancement improves the maintainability and functionality of the application.
2024-06-11 18:29:19 +01:00
Simon Larsen
16b761e498 feat: Add option to enable pull requests for services in ServiceRepositoryPage
This commit adds a new field to the ServiceRepositoryPage component, allowing users to enable or disable pull requests for a service. When enabled, OneUptime will create pull requests for the service and automatically improve the code. This enhancement provides more control over pull request generation and improves the functionality of the ServiceRepositoryPage.
2024-06-11 18:21:51 +01:00
Simon Larsen
9b1e702c64 refactor: Add enablePullRequests property to ServiceRepository model
The enablePullRequests property has been added to the ServiceRepository model. This property allows for enabling or disabling automatic pull request creation by Copilot for this service. By default, enablePullRequests is set to true, indicating that Copilot will create pull requests for this service to automatically improve the codebase. This change enhances the functionality of the ServiceRepository model and provides more control over pull request generation.
2024-06-11 18:19:51 +01:00
Simon Larsen
f10fa9a48e ```text
refactor: Update defaultValue property in Field interface

The defaultValue property in the Field interface has been updated to include the number type. This change allows for setting default values of type number in form fields.
2024-06-11 18:15:09 +01:00
Simon Larsen
de91346155 refactor: Remove CopilotServiceService and update references to ServiceRepositoryService 2024-06-11 17:49:14 +01:00
Simon Larsen
629a442ff7 refactor: Remove CopilotServiceService and update references to ServiceRepositoryService
This commit removes the CopilotServiceService module, which is no longer needed. It also updates the references to the CopilotService class to use the ServiceRepository class instead. This change improves code organization and consistency by using the appropriate service class for managing service repositories.
2024-06-11 17:38:18 +01:00
Simon Larsen
be54d782e5 refactor: Update page title in CodeRepositoryViewLayout component 2024-06-11 17:30:39 +01:00
Simon Larsen
029c1b0704 refactor: Add CopilotService to BaseAPIFeatureSet
This commit adds the CopilotService to the BaseAPIFeatureSet in the Index.ts file. The CopilotService is imported from the CopilotServiceService module and is used to create a new router for the "/app" endpoint. This change allows for handling requests related to the CopilotService in the application.
2024-06-11 16:56:42 +01:00
Simon Larsen
36cfb7e20f refactor: Add new migrations for SchemaMigrations and Models
New migrations have been added to the SchemaMigrations and Models directories. These migrations introduce new changes to the database schema and model definitions. This commit ensures that the codebase is up to date with the latest schema changes and improves the maintainability of the application.
2024-06-11 16:52:56 +01:00
Simon Larsen
02046a525e refactor: Update service catalog titles to use consistent naming convention
The titles of the ServiceCatalog and ServiceCatalogOwnerTeam classes have been updated to use a consistent naming convention. The "ServiceCatalog" title has been changed to "Service Catalog" and the "ServiceCatalog ID" title has been changed to "Service Catalog ID". This change improves clarity and readability in the codebase.
2024-06-11 16:51:12 +01:00
Simon Larsen
c9a998da0b refactor: Add service language dropdown in ServiceCatalog form 2024-06-11 16:35:23 +01:00
Simon Larsen
7fc192e466 refactor: Quote the value of ALLOWED_ACTIVE_MONITOR_COUNT_IN_FREE_PLAN in _helpers.tpl
The value of ALLOWED_ACTIVE_MONITOR_COUNT_IN_FREE_PLAN in _helpers.tpl has been updated to be quoted using the | quote filter. This change ensures that the value is treated as a string, improving consistency and compatibility with other parts of the codebase.
2024-06-11 16:24:55 +01:00
Simon Larsen
eae8b79b2e refactor: Add debug configuration for running Copilot locally
A new debug configuration has been added to the launch.json file. This configuration allows for launching Copilot locally by running the "start" script using npm. It skips files in the "<node_internals>" directory and is specifically configured for debugging Node.js applications. This change improves the development experience by enabling easy debugging of Copilot locally.
2024-06-11 15:11:00 +01:00
Simon Larsen
08c6cf31a0 refactor: Update linting configuration to exclude .tsx files
The linting configuration in the package.json file has been updated to exclude .tsx files from linting. This change ensures that the linting process only targets .ts files and improves the efficiency of the linting process.
2024-06-11 15:04:28 +01:00
Simon Larsen
dfb7f2320c refactor: Update jest.config.json files with testPathIgnorePatterns
The jest.config.json files in the Model, Probe, Common, Copilot, CommonUI, Ingestor, IsolatedVM, TestServer, and CommonServer directories have been updated. The "testPathIgnorePatterns" property has been added to each file, excluding the "node_modules" and "dist" directories from test path matching. This change improves test performance and ensures that unnecessary files are not included in the test coverage.
2024-06-11 14:52:55 +01:00
Simon Larsen
c53b14f88f refactor: Update CodeRepositoryUtil methods to accept repoPath parameter
The CodeRepositoryUtil methods getGitCommitHashForFile and getFilesInDirectory have been updated to accept a repoPath parameter. This change allows for specifying the repository path when retrieving the git commit hash for a file or getting the files in a directory. It improves the flexibility and reusability of the CodeRepositoryUtil class.
2024-06-11 14:24:19 +01:00
Simon Larsen
c5680f6c26 refactor: Update import statements in MonitorService.ts
The import statements in the MonitorService.ts file have been updated to import the AllowedActiveMonitorCountInFreePlan and IsBillingEnabled constants from the EnvironmentConfig module. This change ensures that the codebase is using the correct import paths and improves code readability.
2024-06-11 13:53:05 +01:00
Simon Larsen
d2a1385123 refactor: Update ALLOWED_ACTIVE_MONITOR_COUNT_IN_FREE_PLAN to 10
The ALLOWED_ACTIVE_MONITOR_COUNT_IN_FREE_PLAN constant has been updated to 10 in multiple files. This change aligns the codebase with the new limit for active monitors allowed in the free plan.
2024-06-11 13:50:55 +01:00
Simon Larsen
feda1b0426 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-11 13:26:28 +01:00
Simon Larsen
b97cc46a1e refactor: Remove commented code in NavBar.tsx
The commented code in the NavBar.tsx file has been removed. This change cleans up the codebase and improves readability.
2024-06-11 13:26:00 +01:00
Simon Larsen
41a8101b54 refactor: Update CodeRepositoryAPI endpoint to use POST method for getting code repository 2024-06-11 13:25:41 +01:00
Simon Larsen
676a2b18b3 refactor: Update CodeRepositoryAPI endpoint to use POST method for getting code repository 2024-06-11 13:20:52 +01:00
Simon Larsen
df7477929b refactor: Update CodeRepositoryAPI endpoint to use POST method for getting code repository
This code change updates the CodeRepositoryAPI endpoint in the CodeRepositoryAPI.ts file to use the POST method instead of the GET method for getting the code repository. The route has also been modified to "/get-code-repository/:secretkey" to align with the API design. This change ensures that the code repository is retrieved securely and follows the recommended RESTful API practices.
2024-06-11 13:00:33 +01:00
Simon Larsen
c1ebe14c50 refactor: Add CodeRepositoryAPI to BaseAPIFeatureSet
This code change adds the CodeRepositoryAPI endpoint to the BaseAPIFeatureSet in the App/FeatureSet/BaseAPI/Index.ts file. It imports the CodeRepository model and service, and includes the necessary routing and configuration for the endpoint. This change allows for the CRUD operations on CodeRepository data through the API.
2024-06-11 12:47:47 +01:00
Simon Larsen
2b478e7a13 refactor: Add TableBillingAccessControl to MonitorOwnerTeam, MonitorOwnerUser, StatusPageOwnerTeam, MonitorGroupOwnerTeam, MonitorGroupOwnerUser models
This code change adds the TableBillingAccessControl decorator to the MonitorOwnerTeam, MonitorOwnerUser, StatusPageOwnerTeam, MonitorGroupOwnerTeam, and MonitorGroupOwnerUser models. The decorator configures the access control settings for these models based on the specified subscription plans. This change ensures that the appropriate access control rules are applied when creating, reading, updating, or deleting records in these models.
2024-06-11 12:37:48 +01:00
Simon Larsen
3bb1d93f3e feat: Add forceNavigate option when navigating to new item
The DuplicateModel component in CommonUI has been updated to include a new option, forceNavigate, when navigating to a new item. This option allows for forced navigation to the new item, bypassing any checks or validations. This change provides more control over the navigation behavior and ensures consistent navigation to the new item.
2024-06-11 12:29:50 +01:00
Simon Larsen
703c4b7685 feat: Add doNotShowWhenCreating option to Field interface
The Field interface in the CommonUI project has been updated to include a new property, doNotShowWhenCreating. This property allows developers to specify whether a field should be shown in the form when creating a new entity. By setting doNotShowWhenCreating to true, the field will be hidden during the creation process. This change provides more control over the visibility of fields in the form based on the create or edit mode.
2024-06-11 11:33:26 +01:00
Simon Larsen
d7e9776a3c refactor: Update CodeRepository.getRepository() to return a Promise
Update CodeRepository.getRepository() to return a Promise<CodeRepositoryModel> instead of a string. This change improves the functionality and flexibility of the CodeRepository class.
2024-06-11 11:10:36 +01:00
Simon Larsen
3cb29b63fe refactor: Update CodeRepository.getRepository() to return a Promise
The CodeRepository.getRepository() method has been updated to return a Promise<CodeRepositoryModel> instead of a string. This change ensures that the method is asynchronous and can handle asynchronous operations, improving the overall functionality and flexibility of the CodeRepository class.
2024-06-10 22:10:29 +01:00
Simon Larsen
e7f4a36ec9 refactor: Update Copilot startup message for clarity
The startup message in the Copilot/Index.ts file has been updated to provide a clearer description of the application. This change improves the readability and understanding of the log output during the startup process.
2024-06-10 22:09:25 +01:00
Simon Larsen
be78862e49 Merge pull request #1470 from OneUptime/snyk-upgrade-ff9eba0658b72fe88ae2d11836a86990
[Snyk] Upgrade axios from 1.6.8 to 1.7.1
2024-06-10 19:45:41 +01:00
Simon Larsen
64ae5eeb89 add code repository basic functions 2024-06-10 19:40:27 +01:00
Simon Larsen
78bdc42534 refactor: Update SelfSignedSSL class to use async/await for generating SSL certificates 2024-06-10 19:25:41 +01:00
snyk-bot
68c81734e8 fix: upgrade axios from 1.6.8 to 1.7.1
Snyk has created this PR to upgrade axios from 1.6.8 to 1.7.1.

See this package in npm:
axios

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/f6446ec8-d441-487e-b58f-38373430e213?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-10 17:16:56 +00:00
Simon Larsen
bf081d1ebe refactor: Update file paths in code changes 2024-06-10 17:59:22 +01:00
Simon Larsen
3de407842e refactor: Add CopilotEvent API endpoint to BaseAPIFeatureSet
This code change adds the CopilotEvent API endpoint to the BaseAPIFeatureSet in the App/FeatureSet/BaseAPI/Index.ts file. It imports the CopilotEvent model and service, and includes the necessary routing and configuration for the endpoint. This change allows for the CRUD operations on CopilotEvent data through the API.
2024-06-10 17:45:00 +01:00
Simon Larsen
a4a9e45fe0 refactor: Update Dockerfile and build steps for Copilot service
This code change updates the Dockerfile and build steps for the Copilot service. It adds a new workflow job, `docker-build-copilot`, which builds the Docker image for the Copilot service. The job includes steps to checkout the code, preinstall dependencies, and build the Docker image using the specified Dockerfile. This change ensures that the Copilot service is built and deployed correctly in the CI/CD pipeline.
2024-06-10 17:19:25 +01:00
Simon Larsen
f9c9480434 refactor: Update logger to use configured log level
This code change updates the logger class to use the configured log level from the environment configuration. The getLogLevel method is added to retrieve the log level, and the info, error, warn, and debug methods are updated to check the log level before logging the message. This change ensures that the logger behaves according to the configured log level, improving the consistency and control of log output.
2024-06-10 17:00:07 +01:00
Simon Larsen
eb644ad2f2 Merge branch 'master' into ai-copilot-main 2024-06-10 16:45:19 +01:00
Simon Larsen
5186e193a8 Merge pull request #1468 from OneUptime/snyk-upgrade-d773ac20b9cf77163d96fbbdf2660a1f
[Snyk] Upgrade axios from 1.6.8 to 1.7.0
2024-06-10 14:39:04 +01:00
Simon Larsen
55d947fb39 refactor: Add isMonotonic column to Metric model
This code change adds a new column, 'isMonotonic', to the Metric model in the AnalyticsModels directory. The column is optional and represents whether the metric is monotonic. This change ensures that the necessary data is captured and stored correctly for metrics in the system.
2024-06-10 12:49:29 +01:00
Simon Larsen
77f1262ff5 refactor: Update Telemetry class to add gauge and histogram metrics
This code change updates the Telemetry class in the CommonServer/Utils directory to include methods for creating gauge and histogram metrics. The getGauge and getHistogram methods are added, allowing for the creation of observable gauges and histograms with specified names and descriptions. This change enhances the telemetry capabilities of the application by providing more options for metric tracking and analysis.
2024-06-10 12:39:49 +01:00
Simon Larsen
47bf8f9c89 refactor: Update EventItem component to dynamically apply styles based on event type
This code change updates the EventItem component to dynamically apply styles based on the event type. The classNames for the title and description elements are now generated based on the eventType prop, allowing for more flexibility in styling. This change improves the visual representation of different event types in the application.
2024-06-10 11:48:47 +01:00
Simon Larsen
4ca4f28d1c refactor: Add Point Type to Metric model
This code change adds a new column, 'Metric Point Type', to the Metric model in the AnalyticsModels directory. The column is optional and represents the type of metric point. This change ensures that the necessary data is captured and stored correctly for metrics in the system.
2024-06-10 11:45:23 +01:00
Simon Larsen
b6565ce2bb refactor: Add Aggregation Temporality column to Metric model
This code change adds a new column, 'Aggregation Temporality', to the Metric model in the AnalyticsModels directory. The column is required and represents the aggregation temporality of the metric. This change ensures that the necessary data is captured and stored correctly for metrics in the system.
2024-06-10 11:34:08 +01:00
snyk-bot
0704e1f556 fix: upgrade axios from 1.6.8 to 1.7.0
Snyk has created this PR to upgrade axios from 1.6.8 to 1.7.0.

See this package in npm:
axios

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/49c81d9c-12c2-4e8e-b9e8-72f98b1b595c?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-10 04:54:58 +00:00
Simon Larsen
87c16d7bc3 refactor: Update needs array in test-e2e-release-saas and test-e2e-release-self-hosted jobs
This code change updates the needs array in the test-e2e-release-saas and test-e2e-release-self-hosted jobs in the release.yml file. The nginx-docker-image-deploy job has been added to the needs array to ensure that it is executed before these jobs. This change ensures that the necessary dependencies are met for the successful execution of the test-e2e-release-saas and test-e2e-release-self-hosted jobs.
2024-06-09 21:47:31 +01:00
Simon Larsen
cc66820e7b refactor: Remove commented code in NavBar component 2024-06-09 19:45:25 +01:00
Simon Larsen
a478f60a39 Merge branch 'master' of github.com:OneUptime/oneuptime 2024-06-09 19:45:00 +01:00
Simon Larsen
5637f12d3a refactor: Remove commented code in NavBar component
This code change removes the commented code in the NavBar component that was no longer needed. The commented code was related to the AI Copilot feature and the Service Catalog feature, which have been refactored or removed from the application. Removing this commented code improves code readability and reduces clutter in the component.
2024-06-09 19:44:57 +01:00
Simon Larsen
27c28b17af refactor: Update viewPageRoute in CodeRepositoryPage component 2024-06-09 19:44:41 +01:00
Simon Larsen
c55b169488 Merge pull request #1460 from OneUptime/snyk-upgrade-46c810649599bbd5f034d681106116a8
[Snyk] Upgrade react-big-calendar from 1.12.1 to 1.12.2
2024-06-09 19:36:50 +01:00
Simon Larsen
9b584d69ff refactor: Update viewPageRoute in CodeRepositoryPage component 2024-06-09 19:35:28 +01:00
Simon Larsen
05c090445a change job names 2024-06-09 19:29:59 +01:00
Simon Larsen
597aeb74f4 add e2e to test release 2024-06-09 19:29:23 +01:00
Simon Larsen
b7191a9c2e update github e2e jobs 2024-06-09 19:25:34 +01:00
Simon Larsen
c686030014 ```text
refactor: Update viewPageRoute in CodeRepositoryPage component

This code change updates the viewPageRoute prop in the CodeRepositoryPage component to use the new route generated by the Navigation utility. This ensures that the component navigates to the correct view page when a code repository is clicked.
2024-06-09 19:21:02 +01:00
Simon Larsen
eed1078f06 refactor: Add viewPageRoute prop to CodeRepositoryPage component
This code change adds the viewPageRoute prop to the CodeRepositoryPage component in order to specify the route for viewing a code repository. This prop is set to the corresponding route from the RouteMap. By including this prop, the component will correctly navigate to the view page when the user clicks on a code repository.
2024-06-09 19:15:30 +01:00
Simon Larsen
051a3c43b2 refactor: Update Git Repository name to "Git Repositories" 2024-06-09 19:04:45 +01:00
Simon Larsen
a152813535 refactor: Add CodeRepository model and service
This code change adds the CodeRepository model and service to the project. It includes the following modifications:

- Added CodeRepository model to the Models/Index.ts file.
- Added CodeRepositoryService to the Services/Index.ts file.
- Created CodeRepositoryService.ts file with the necessary implementation.

These changes enable the project to manage code repositories.
2024-06-09 19:03:54 +01:00
Simon Larsen
decea5acfc refactor: Add AI Copilot breadcrumbs and code repository view 2024-06-09 19:03:23 +01:00
Simon Larsen
4c2dfb0f92 refactor: Add CodeRepository model, service, and permissions
This code change adds the CodeRepository model, service, and permissions to the project. It includes the following modifications:

- Added CodeRepository model to the Models/Index.ts file.
- Added CodeRepositoryService to the Services/Index.ts file.
- Created CodeRepositoryService.ts file with the necessary implementation.
- Updated Permission enum in the Permission.ts file to include CreateCodeRepository, DeleteCodeRepository, EditCodeRepository, and ReadCodeRepository permissions.

These changes enable the project to manage code repositories and define the necessary permissions for them.
2024-06-09 15:03:56 +01:00
Simon Larsen
a24bf077ce refactor: Improve error message in endpoint-status.sh
This code change updates the endpoint-status.sh script to improve the error message when the endpoint returns an HTTP status other than 200. The previous message mentioned that it usually takes a few minutes for the app to boot, which is not accurate. The updated message removes this misleading information and provides a more accurate description of the retry behavior.
2024-06-09 14:49:48 +01:00
Simon Larsen
2d82f50789 refactor: Enable cleanup and e2e cron jobs for development purposes 2024-06-09 14:39:14 +01:00
Simon Larsen
3e13776252 refactor: Improve BaseModelTable actions column logic
This code change updates the BaseModelTable component to improve the logic for determining whether to show the actions column. Previously, the actions column was shown based on various conditions, including permissions, action buttons, and the showViewIdButton prop. This logic has been refactored to simplify the conditions and make it easier to understand.

- The showActionsColumn variable is now initialized with the result of the Boolean function, which checks if any of the conditions are met.
- Additionally, if the user is a master admin, the actions column will always be shown, regardless of other conditions.

These changes enhance the readability and maintainability of the code, ensuring that the actions column is displayed correctly based on the specified conditions.
2024-06-09 13:18:56 +01:00
Simon Larsen
463bb32872 refactor: Enable cleanup and e2e cron jobs for development purposes
This code change updates the values.yaml file in the HelmChart/Public/oneuptime directory. It enables the cleanup and e2e cron jobs for development purposes. Please note that these cron jobs should not be enabled in production environments. This change allows for easier testing and debugging during development.
2024-06-09 12:48:42 +01:00
Simon Larsen
99dcee80cd refactor: Add support for Go language in CodeQL analysis workflow 2024-06-08 14:54:28 +01:00
Simon Larsen
c418dc41dd refactor: Add TypeScript support to CodeQL analysis workflow
This code change updates the CodeQL analysis workflow in the .github/workflows/codeql-analysis.yml file. It adds TypeScript as a supported language for CodeQL analysis, in addition to JavaScript. This ensures that the codebase can be thoroughly analyzed for potential security vulnerabilities and bugs in both JavaScript and TypeScript code.
2024-06-08 14:54:02 +01:00
Simon Larsen
c0678c410d refactor: Update SideMenu.tsx to fix indentation issue
This code change updates the SideMenu.tsx file in the ServiceCatalog/View directory. It fixes an indentation issue in the SideMenuItem component by properly aligning the opening tag. This ensures consistent code formatting and improves code readability.
2024-06-08 14:34:56 +01:00
Simon Larsen
081359f7e0 refactor: Update Delete.tsx to navigate to Service Catalog page after successful deletion
This code change updates the Delete.tsx file in the ServiceCatalog/View directory. It modifies the onDeleteSuccess callback function to navigate to the Service Catalog page (RouteMap[PageMap.SERVICE_CATALOG]) after a successful deletion. This ensures a smooth user experience by redirecting them to the appropriate page after completing the deletion process.
2024-06-08 14:26:02 +01:00
Simon Larsen
cc0cfe4f8c refactor: Update Settings.tsx to import ServiceCatalog instead of TelemetryService 2024-06-08 14:24:42 +01:00
Simon Larsen
dc87905f05 refactor: Update ServiceCatalogPage to include lazy loading for ServiceCatalogElement 2024-06-08 14:24:05 +01:00
Simon Larsen
9c31047d52 refactor: Update ServiceCatalogPage to include lazy loading for ServiceCatalogElement
This code change updates the ServiceCatalogPage component in ServiceCatalog.tsx to include lazy loading for the ServiceCatalogElement component. By implementing lazy loading, the page load performance is improved as the ServiceCatalogElement component is only loaded when it is actually needed. This enhances the overall user experience by reducing initial page load time.
2024-06-08 14:20:21 +01:00
Simon Larsen
91d196ddea refactor: Update ServiceCatalogRoutePath in RouteMap.ts
This code change updates the ServiceCatalogRoutePath in the RouteMap.ts file to include new routes for viewing, managing owners, and deleting service catalogs. This ensures that the application can properly handle these actions related to service catalogs within the dashboard.
2024-06-08 14:12:41 +01:00
Simon Larsen
78db5cab39 refactor: Update ServiceCatalogRoutePath in RouteMap.ts 2024-06-08 14:12:06 +01:00
Simon Larsen
689e72e5ec refactor: Update ServiceCatalogRoutePath in RouteMap.ts
This code change updates the ServiceCatalogRoutePath in the RouteMap.ts file to include new routes for viewing, managing owners, and deleting service catalogs. This ensures that the application can properly handle these actions related to service catalogs within the dashboard.
2024-06-08 14:05:24 +01:00
Simon Larsen
bc9e97f67c refactor: Fix typo in status pages description 2024-06-08 13:57:48 +01:00
Simon Larsen
19550c23ed refactor: Add ServiceCatalogOwnerTeamService and ServiceCatalogOwnerUserService to Services/Index.ts
This code change adds the ServiceCatalogOwnerTeamService and ServiceCatalogOwnerUserService to the Services/Index.ts file. These services are necessary for managing ownership of Service Catalogs, allowing teams and individual users to be assigned as owners of specific Service Catalogs.
2024-06-08 13:33:53 +01:00
Simon Larsen
2d09df2d87 feat: Add ServiceCatalogOwnerTeam and ServiceCatalogOwnerUser models
This code change adds the ServiceCatalogOwnerTeam and ServiceCatalogOwnerUser models to the project. These models are necessary for managing ownership of Service Catalogs, allowing teams and individual users to be assigned as owners of specific Service Catalogs.
2024-06-08 13:31:40 +01:00
Simon Larsen
2dfebdd2e4 refactor: Update SchemaMigrations/Index.ts to fix formatting
This code change fixes the formatting in the SchemaMigrations/Index.ts file. The changes include removing unnecessary whitespace and ensuring consistent indentation. This improves code readability and maintainability.
2024-06-08 13:16:51 +01:00
Simon Larsen
ebec143c9c refactor: Import and include ServiceCatalogService and ServiceCatalog model
This code change updates the Index.ts and Models/Index.ts files to import and include the ServiceCatalogService and ServiceCatalog model respectively. This allows for the management of Service Catalogs, including creating, deleting, editing, and reading them within the project.
2024-06-08 10:35:17 +01:00
Simon Larsen
aa68a6316a feat: Add Service Catalog permissions
This code change adds new permissions for managing Service Catalogs. The permissions include creating, deleting, editing, and reading Service Catalogs. These permissions allow users to perform various actions related to Service Catalogs within the project.

Refactor: Update Index.ts and Models/Index.ts to import and include the ServiceCatalogService and ServiceCatalog model respectively.
2024-06-08 10:25:37 +01:00
Simon Larsen
27a37581e4 Merge pull request #1461 from OneUptime/metric-detail
refactor: Update Navigation class to use getLastParamAsString method
2024-06-08 09:51:32 +01:00
Simon Larsen
091622f8cf refactor: Update StatementGenerator.ts to improve code readability and maintainability 2024-06-08 09:49:49 +01:00
Simon Larsen
87caae077c ```text
refactor: Change metric column types to decimal

This code change modifies the Metric model in the AnalyticsModels directory to change the column types of various metrics from TableColumnType.Number to TableColumnType.Decimal. This update ensures more accurate and precise calculations for the metrics.
2024-06-07 22:55:39 +01:00
Simon Larsen
a146691773 refactor: Improve code readability and maintainability in LogItem.tsx 2024-06-07 22:16:36 +01:00
Simon Larsen
9fce103b11 refactor: Update ResetPassword.tsx to improve password confirmation validation 2024-06-07 22:04:56 +01:00
Simon Larsen
2aa0ae89fc refactor: Improve code readability and maintainability in OTelIngest.ts 2024-06-07 21:45:09 +01:00
Simon Larsen
0a16f6bf44 refactor: Update OTelIngest.ts to improve code readability and maintainability 2024-06-07 21:27:11 +01:00
Simon Larsen
0f49e6e100 refactor: Improve code readability and maintainability in OTelIngest.ts 2024-06-07 17:49:58 +01:00
Simon Larsen
d954b4a5df refactor: Add unit column to metrics table and improve code readability in StatementGenerator.ts 2024-06-07 17:36:09 +01:00
Simon Larsen
e762778fc6 refactor: Improve code readability and maintainability in StatementGenerator.ts 2024-06-07 17:33:23 +01:00
Simon Larsen
4cced50857 feat: Add unit column to metrics table 2024-06-07 17:00:30 +01:00
Simon Larsen
26c900d8e2 refactor: Update CommonServer/package.json and Ingestor/Service/OTelIngest.ts
This code change updates the CommonServer/package.json file to remove the "@opentelemetry/metrics" dependency and adds the "@opentelemetry/sdk-metrics" dependency with version "^1.21.0". It also updates the Ingestor/Service/OTelIngest.ts file to import the "JSONFunctions" module from "Common/Types/JSONFunctions" and use the "flattenObject" function from that module to flatten the final object before returning it.
2024-06-07 16:57:24 +01:00
Simon Larsen
63461343ba refactor: Update OTelIngest.ts to improve code readability and maintainability
This code change updates the OTelIngest.ts file to improve code readability and maintainability. It includes formatting changes such as indentation and line breaks to enhance code structure and organization. These modifications make the code easier to understand and maintain for future development.
2024-06-07 14:57:24 +01:00
Simon Larsen
931abc522b refactor: Update Telemetry class to include new metrics for status checks 2024-06-07 14:54:39 +01:00
Simon Larsen
054592eed3 refactor: Update Telemetry class to include new metrics for status checks
This code change updates the Telemetry class to include new metrics for status checks. It adds counters for successful and failed status checks, including separate counters for ready and live checks. This modification enhances the monitoring capabilities of the application and provides more granular insights into the status of the system.
2024-06-07 14:25:40 +01:00
Simon Larsen
82b2307b51 Merge branch 'master' into metric-detail 2024-06-07 12:50:17 +01:00
Simon Larsen
b1dba73842 refactor: Update external database configuration in HelmChart
This code change updates the external database configuration in the HelmChart. It adds support for using an existing secret for the password instead of directly specifying the password. This modification enhances security and allows for easier management of the database credentials.
2024-06-07 10:11:27 +01:00
Simon Larsen
babbf5f8a6 refactor: Update external database configuration in HelmChart 2024-06-07 10:10:55 +01:00
Simon Larsen
39c7da79ab refactor: Update external database configuration in HelmChart
This code change updates the external database configuration in the HelmChart. It adds support for using an existing secret for the password instead of directly specifying the password. This modification enhances security and allows for easier management of the database credentials.
2024-06-07 10:10:00 +01:00
Simon Larsen
938bd32915 refactor: Update PageMap and RouteMap to include new telemetry metric page
This code change updates the PageMap and RouteMap files to include a new telemetry metric page. The new page, TELEMETRY_SERVICES_VIEW_METRIC, is added to both files with its corresponding route path. This modification ensures that the new page is properly mapped and accessible within the application.
2024-06-07 10:08:40 +01:00
Simon Larsen
f8e1ace311 refactor: Update Navigation class to use getLastParamAsString method 2024-06-06 21:45:29 +01:00
Simon Larsen
05e2e22e1d refactor: Update DATABASE_USERNAME value in _helpers.tpl
This code change updates the value of DATABASE_USERNAME in the _helpers.tpl file. The value is changed to "postgres" when the postgresql.enabled flag is true, and to the value of $.Values.externalPostgres.username when the flag is false. This modification ensures that the correct username is used for the database connection.
2024-06-06 21:19:19 +01:00
Simon Larsen
9054c49b3e refactor: Update Kubernetes secret retrieval commands
The code changes update the commands used to retrieve secrets from Kubernetes. The previous commands were using the deprecated `go-template` option, which has been replaced with the `jsonpath` option. This refactor ensures that the correct commands are used to retrieve the secrets, improving the reliability and maintainability of the code.
2024-06-06 18:36:05 +01:00
Simon Larsen
5d5468603f refactor: Add lazy loading for images in DateFilter component
This code change adds lazy loading for images in the DateFilter component. By implementing lazy loading, the images in the component will only load when they are in the viewport, improving the page load performance. This enhancement provides a better user experience by reducing the initial load time of the page.
2024-06-06 17:49:43 +01:00
Simon Larsen
4c6979cfa1 refactor: Add date filter to FiltersForm and FilterViewer components
This code change adds a new date filter to the FiltersForm and FilterViewer components. The date filter allows users to filter data based on a specific date range. This enhancement improves the filtering capabilities of the components and provides users with more flexibility in data analysis.
2024-06-06 17:40:24 +01:00
Simon Larsen
714a4be2b0 refactor: Update DatabaseService to set isRoot flag when updating items
This code change updates the DatabaseService class to set the isRoot flag to true when updating items. Previously, the props object in the update query only included the ignoreHooks flag. By adding the isRoot flag, we ensure that the update operation is performed as a root user, bypassing any access restrictions or hooks. This modification enhances the flexibility and control of the update process.
2024-06-06 14:43:11 +01:00
Simon Larsen
b935443f96 refactor: Update PingMonitorView to display monitor destination and port
This code change updates the PingMonitorView component to display the monitor destination and port. It ensures that the destination URL or IP address and the corresponding port are correctly displayed in the component. This enhancement improves the visibility of the monitoring information for users.
2024-06-06 14:28:32 +01:00
Simon Larsen
d3a3f01f20 refactor: Update monitorDestination and monitorDestinationPort in ProbeMonitorResponse interface
This code change updates the ProbeMonitorResponse interface to include the monitorDestination and monitorDestinationPort properties. These properties represent the destination URL or IP address and the corresponding port for monitoring. By adding these properties to the interface, we ensure that the necessary information is available for monitoring purposes.
2024-06-06 13:58:51 +01:00
snyk-bot
56b0fea04a fix: upgrade react-big-calendar from 1.12.1 to 1.12.2
Snyk has created this PR to upgrade react-big-calendar from 1.12.1 to 1.12.2.

See this package in npm:
react-big-calendar

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-06 03:46:25 +00:00
Simon Larsen
2605140166 refactor: Update DATABASE_USERNAME value in _helpers.tpl
This code change updates the value of DATABASE_USERNAME in the _helpers.tpl file. The value is changed to "postgres" when the postgresql.enabled flag is true, and to the value of $.Values.externalPostgres.username when the flag is false. This modification ensures that the correct username is used for the database connection.
2024-06-05 19:03:49 +01:00
Simon Larsen
8b9611e145 refactor: Update import statement for InitialMigration in Postgres SchemaMigrations 2024-06-05 17:52:16 +01:00
Simon Larsen
21057038d1 refactor: Update import statement for InitialMigration in Postgres SchemaMigrations
This code change updates the import statement for the InitialMigration file in the Postgres SchemaMigrations folder. The file name was changed from "1717605043663-MigrationName.ts" to "1717605043663-InitialMigration.ts". This refactor ensures that the correct file is imported and used for schema migrations.
2024-06-05 17:36:45 +01:00
Simon Larsen
e587d4ba19 refactor: Update Postgres migration generation command to use correct file path 2024-06-05 17:33:30 +01:00
Simon Larsen
14da201c8d refactor: Remove unused PostgresConfig file and update PostgresDatabase imports 2024-06-05 17:26:48 +01:00
Simon Larsen
f5584a5037 Add error handling to monitor probing in the FetchListAndProbe class. This change modifies the code to catch any errors that occur during the probing process and log them using the logger. This enhancement improves the robustness of the monitoring functionality by ensuring that errors are properly handled and logged. 2024-06-05 13:30:33 +01:00
Simon Larsen
157f8e95d7 refactor: Update TableRow component to include padding in drag handle 2024-06-05 12:59:35 +01:00
Simon Larsen
fb83126f37 Update Postgres password retrieval in Helm chart documentation 2024-06-05 12:27:31 +01:00
Simon Larsen
964def0c45 refactor: Disable ClickHouse when not enabled in values.yaml 2024-06-05 12:16:40 +01:00
Simon Larsen
650d7cc939 refactor: Add support for HTTPS in ClickHouse configuration 2024-06-05 11:42:01 +01:00
Simon Larsen
bfb4c46bd0 refactor: Update ClickHouse configuration to support HTTPS
This code change updates the ClickHouse configuration to support HTTPS. It introduces a new environment variable, `ClickHouseIsHostHttps`, which is set to `true` in the `EnvironmentConfig.ts` file. The `ClickhouseConfig.ts` file is modified to conditionally set the host protocol to `https` based on the value of `ClickHouseIsHostHttps`. This enhancement allows users to easily configure ClickHouse to use HTTPS when connecting to the host.
2024-06-05 11:41:39 +01:00
Simon Larsen
149c8c763d refactor: Remove empty line in values.yaml 2024-06-05 10:57:57 +01:00
Simon Larsen
fdbcace48c refactor: Update ClickHouse TLS configuration to use "tls" instead of "ssl" in values.yaml 2024-06-05 10:53:47 +01:00
Simon Larsen
3cfe0517a8 refactor: Update ClickHouse environment variables 2024-06-05 10:53:05 +01:00
Simon Larsen
9a32a47146 refactor: Update Redis and ClickHouse TLS configuration
This code change updates the Redis and ClickHouse TLS configuration to support the new `RedisTlsCert`, `RedisTlsKey`, `ClickhouseTlsCert`, and `ClickhouseTlsKey` environment variables. It modifies the `Redis.ts` and `ClickhouseConfig.ts` files to conditionally set the TLS options based on the presence of these variables. This enhancement allows users to easily enable TLS for Redis and ClickHouse by providing the necessary certificate and key files.
2024-06-05 10:49:01 +01:00
Simon Larsen
fd83a71a56 refactor: Enable Redis and ClickHouse in Helm chart
This code change enables Redis and ClickHouse in the Helm chart by setting the `enabled` flag to `true` for both services in the `values.yaml` file. This enhancement allows users to utilize Redis and ClickHouse functionalities when deploying the Helm chart.
2024-06-05 10:08:11 +01:00
snyk-bot
070190dd31 fix: upgrade @nivo/line from 0.86.0 to 0.87.0
Snyk has created this PR to upgrade @nivo/line from 0.86.0 to 0.87.0.

See this package in npm:
@nivo/line

See this project in Snyk:
https://app.snyk.io/org/oneuptime-RsC2nshvQ2Vnr35jHvMnMP/project/47001ef1-7b3a-49c2-88cd-8025c56346d0?utm_source=github&utm_medium=referral&page=upgrade-pr
2024-06-03 04:20:30 +00:00
2000 changed files with 270748 additions and 214441 deletions

68
.bash_profile Normal file
View File

@@ -0,0 +1,68 @@
# These are aliases that will make your life simple when you're building OneUptime
# Make directory and change directory at the same time.
mkcdir ()
{
mkdir -p -- "$1" &&
cd -P -- "$1"
}
# Git aliases
alias g="git"
alias gs="git status"
alias ga="git add"
alias gc="git checkout"
alias gb="git branch"
alias gp="git pull"
alias gpo="git push origin"
alias gl="git log"
alias gd="git diff"
alias gm="git merge"
# Kubernetes aliases
alias k="kubectl"
alias kg="kubectl get"
alias kd="kubectl describe"
alias kc="kubectl create"
alias kdel="kubectl delete"
alias klo="kubectl logs"
alias klof="kubectl logs -f"
alias kex="kubectl exec"
alias kexi="kubectl exec -it"
# Docker aliases
alias d="docker"
alias dc="docker compose"
alias dcu="docker compose up"
alias dcd="docker compose down"
# Node aliases
alias n="npm"
alias ni="npm install"
alias nis="npm install --save"
alias nid="npm install --save-dev"
alias nr="npm run"
alias nt="npm test"
alias ns="npm start"
alias nb="npm build"
# Rust aliases
alias c="cargo"
alias cb="cargo build"
alias cr="cargo run"
# OneUptime Specific Aliases
# --------------------------
alias nrd="npm run dev"
alias nrl="npm run logs"
alias nrb="npm run build"
alias nrfb="npm run force-build"
alias nrps="npm run ps-dev"
# OneUptime LLM Server
alias nrfbl="npm run force-build-llm"
alias nrdl="npm run dev-llm"
alias nrll="npm run logs-llm"
alias nrbl="npm run build-llm"

View File

@@ -56,5 +56,4 @@ settings.json
GoSDK/tester/
Llama/Models/*

View File

@@ -1,28 +0,0 @@
*/node_modules/*
*/build/*
*/coverage/*
*/dist/*
*/public/*
*/views/*
*fonts*
*logos*
.*
*.png
*.sh
*.txt
*.snap
*.enc
Dockerfile
CHANGELOG
LICENSE
marketing/*/*
licenses/*
certifications/*
ApiReference/public/assets/*
JavaScriptSDK/src/cli/server-monitor/out/scripts/prettify/*
_test/*

View File

@@ -1,216 +0,0 @@
{
"parserOptions": {
"ecmaVersion": 8,
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true,
"tsx": true,
"spread": true
},
"sourceType": "module",
"project": [
"./tsconfig.json"
]
},
"env": {
"browser": true,
"node": true,
"jquery": true,
"es6": true,
"jest": true,
"jasmine": true
},
"plugins": [
"react",
"jsx-a11y",
"progress",
"@typescript-eslint",
"unused-imports"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:prettier/recommended",
"prettier"
],
"globals": {
"describe": true,
"context": true,
"before": true,
"beforeEach": true,
"after": true,
"afterEach": true,
"it": true,
"expect": true,
"workbox": true,
"importScripts": true,
"$TSFixMe": true,
"NodeJS": true,
"JSX": true
},
"parser": "@typescript-eslint/parser",
"rules": {
"no-fallthrough": "error",
"no-unreachable": "error",
"no-cond-assign": "error",
"valid-typeof": "error",
"no-func-assign": "error",
"curly": "error",
"no-extra-semi": "error",
"no-else-return": "error",
"no-div-regex": "error",
"no-octal": "error",
"no-extra-bind": "error",
"unicode-bom": "error",
"no-extra-boolean-cast": "error",
"wrap-regex": "error",
"wrap-iife": "error",
"yield-star-spacing": "error",
"no-implicit-coercion": "error",
"no-extra-label": "error",
"multiline-comment-style": "off",
"no-lonely-if": "error",
"no-floating-decimal": "error",
"eqeqeq": "error",
"dot-notation": "off", // Off because it messes up with typescript compiler.
"@typescript-eslint/dot-notation": "off", //temp off.
"progress/activate": 1,
"linebreak-style": [
"error",
"unix"
],
"@typescript-eslint/no-empty-interface": [
"error",
{
"allowSingleExtends": true
}
],
// https://www.npmjs.com/package/eslint-plugin-unused-imports
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/no-extra-non-null-assertion": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_"
}
],
"@typescript-eslint/explicit-member-accessibility": [
"error"
],
"no-console": "error",
"no-undef": "error",
"no-empty": "error",
"no-control-regex": "off",
"prefer-arrow-callback": "error",
"constructor-super": "error",
"no-case-declarations": "error",
"no-mixed-spaces-and-tabs": "error",
"no-useless-escape": "error",
"prettier/prettier": "error",
"react/jsx-no-undef": "error",
"react/jsx-no-bind": [
"error",
{
"allowArrowFunctions": true,
"allowBind": false,
"ignoreRefs": false
}
],
"react/no-children-prop": "error",
"react/no-deprecated": "error",
"react/boolean-prop-naming": "error",
"react/no-is-mounted": "error",
"react/no-find-dom-node": "error",
"one-var-declaration-per-line": "error",
"arrow-parens": "error",
"arrow-body-style": [
"error",
"always"
],
"@typescript-eslint/typedef": [
"error",
{
"arrowParameter": true,
"variableDeclaration": true
}
],
"@typescript-eslint/strict-boolean-expressions": "off", //Need to enable this very soon
"@typescript-eslint/explicit-function-return-type": [
"error",
{
"allowExpressions": true
}
],
"react/no-did-update-set-state": "error",
"react/no-unknown-property": "error",
"react/no-unused-prop-types": "error",
"react/jsx-no-duplicate-props": "error",
"react/no-unused-state": "error",
"react/jsx-uses-vars": "error",
"react/prop-types": "error",
"react/react-in-jsx-scope": "error",
"react/no-string-refs": "error",
"jsx-a11y/href-no-hash": [
0
],
"react/no-unescaped-entities": "error",
"react/display-name": "error",
"react/jsx-pascal-case": "error",
"array-callback-return": "error",
"no-loop-func": "error",
"no-duplicate-imports": "error",
"no-promise-executor-return": "error",
"capitalized-comments": "off", // this is turned off because come commented code should not be capitalized.
"for-direction": "error",
"getter-return": "error",
"jsx-a11y/anchor-is-valid": "error",
"no-async-promise-executor": "error",
"prefer-const": [
"error",
{
"destructuring": "any",
"ignoreReadBeforeAssign": false
}
],
"no-var": "error",
"object-curly-spacing": [
"error",
"always"
],
"no-unneeded-ternary": "error",
"@typescript-eslint/ban-types": [
"error",
{
"types": {
"String": true,
"Boolean": true,
"Number": true,
"Symbol": false,
"{}": true,
"Object": true,
"object": true,
"Function": true
},
"extendDefaults": true
}
]
},
"settings": {
"react": {
"version": "18.1.0"
}
}
}

View File

@@ -1,7 +1,7 @@
---
name: Bug report
about: Create a report to help us improve
title: 'Bug: <Title of the issue>'
title: '<Title of the issue>'
labels: 'bug'
assignees: ''

View File

@@ -1,7 +1,7 @@
---
name: Feature request
about: Suggest an idea for this project
title: 'Enhancement: <Title of the issue>'
title: '<Title of the issue>'
labels: 'enhancement'
assignees: ''

View File

@@ -72,6 +72,22 @@ jobs:
- name: build docker image
run: sudo docker build -f ./App/Dockerfile .
docker-build-copilot:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Preinstall
run: npm run prerun
# build image for accounts service
- name: build docker image
run: sudo docker build -f ./Copilot/Dockerfile .
docker-build-e2e:
runs-on: ubuntu-latest
env:

View File

@@ -34,7 +34,7 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: [ 'javascript', 'typescript', 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

View File

@@ -91,6 +91,20 @@ jobs:
- run: cd CommonUI && npm install --force
- run: cd App && npm install && npm run compile && npm run dep-check
compile-copilot:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: cd Common && npm install
- run: cd Model && npm install
- run: cd CommonServer && npm install
- run: cd Copilot && npm install && npm run compile && npm run dep-check
compile-nginx:
runs-on: ubuntu-latest
env:

View File

@@ -1,16 +0,0 @@
name: Misc / Dependabot Automerge
on:
pull_request:
jobs:
merge:
runs-on: ubuntu-latest
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
- uses: actions/checkout@v2
- uses: ahmadnassri/action-dependabot-auto-merge@v2
with:
target: minor
github-token: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,31 +0,0 @@
name: Playwright Tests
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
env:
BASE_URL: http://localhost
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm ci
- name: Run Server in Docker
run: npm run dev
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: cd Playwright && npm install && npx playwright install && npx playwright test
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

View File

@@ -18,35 +18,12 @@ jobs:
token: ${{secrets.github_token}}
- run: echo "Build number is ${{ steps.buildnumber.outputs.build_number }}"
github-release:
needs: [generate-build-number]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- run: echo "${{needs.generate-build-number.outputs.build_number}}"
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4.2.0
with:
configuration: "./Scripts/Release/ChangelogConfig.json"
- run: echo "Changelog:"
- run: echo "${{steps.build_changelog.outputs.changelog}}"
- uses: ncipollo/release-action@v1
with:
tag: "7.0.${{needs.generate-build-number.outputs.build_number}}"
artifactErrorsFailBuild: true
body: |
${{steps.build_changelog.outputs.changelog}}
helm-chart-deploy:
runs-on: ubuntu-latest
needs: [generate-build-number, github-release]
needs: [generate-build-number]
env:
CI_COMMIT_AUTHOR: Continuous Integration
steps:
@@ -92,7 +69,7 @@ jobs:
git push origin master
nginx-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -152,7 +129,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
e2e-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -212,7 +189,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
isolated-vm-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -272,7 +249,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
test-server-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -332,7 +309,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
otel-collector-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -394,7 +371,7 @@ jobs:
status-page-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -454,7 +431,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
test-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -514,7 +491,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
ingestor-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -574,7 +551,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
probe-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -635,7 +612,7 @@ jobs:
haraka-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -695,7 +672,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
admin-dashboard-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -756,7 +733,7 @@ jobs:
dashboard-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -816,7 +793,7 @@ jobs:
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
app-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -875,8 +852,69 @@ jobs:
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
copilot-docker-image-deploy:
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
oneuptime/copilot
ghcr.io/oneuptime/copilot
tags: |
type=raw,value=release,enable=true
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate Dockerfile from Dockerfile.tpl
run: npm run prerun
# Build and deploy app.
- name: Login to Docker Hub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./Copilot/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
accounts-docker-image-deploy:
needs: [generate-build-number, github-release]
needs: [generate-build-number]
runs-on: ubuntu-latest
steps:
- name: Docker Meta
@@ -938,7 +976,7 @@ jobs:
publish-npm-packages:
runs-on: ubuntu-latest
needs: [generate-build-number, github-release]
needs: [generate-build-number]
env:
CI_PIPELINE_ID: ${{github.run_number}}
NPM_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
@@ -950,9 +988,228 @@ jobs:
run: npm run prerun
- name: Publish Infrastructure Agent
run: bash ./Scripts/NPM/PublishAllPackages.sh
llm-docker-image-deploy:
needs: generate-build-number
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
oneuptime/llm
ghcr.io/oneuptime/llm
tags: |
type=raw,value=release,enable=true
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}},pattern={{version}},enable=true
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
# - name: Setup Git LFS
# run: git lfs install
# # Cannot do this, no space on the gitHub standard runner. We need to use the large runner which is selfhosted
# - name: Download the Model from Hugging Face
# run: mkdir -p ./LLM/Models && cd ./LLM/Models && git clone https://${{ secrets.HUGGING_FACE_USERNAME }}:${{ secrets.HUGGING_FACE_PASSWORD }}@huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate Dockerfile from Dockerfile.tpl
run: npm run prerun
# Build and deploy nginx.
- name: Login to Docker Hub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./LLM/Dockerfile
context: ./LLM
# arm64 is not supported by the base image of the LLM
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
test-e2e-release-saas:
runs-on: ubuntu-latest
needs: [copilot-docker-image-deploy, accounts-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, dashboard-docker-image-deploy, haraka-docker-image-deploy, ingestor-docker-image-deploy, isolated-vm-docker-image-deploy, otel-collector-docker-image-deploy, probe-docker-image-deploy, status-page-docker-image-deploy, test-docker-image-deploy, test-server-docker-image-deploy, publish-npm-packages, e2e-docker-image-deploy, helm-chart-deploy, generate-build-number, nginx-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: npm run prerun && bash ./Tests/Scripts/enable-billing-env-var.sh
- name: Start Server with release tag
run: npm run start
- name: Wait for server to start
run: bash ./Tests/Scripts/status-check.sh http://localhost
- name: Run E2E Tests. Run docker container e2e in docker compose file
run: export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker compose -f docker-compose.dev.yml logs e2e && exit 1)
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this on failure
if: failure()
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: test-results
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
./E2E
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 7
test-e2e-release-self-hosted:
runs-on: ubuntu-latest
# After all the jobs runs
needs: [copilot-docker-image-deploy, accounts-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, dashboard-docker-image-deploy, haraka-docker-image-deploy, ingestor-docker-image-deploy, isolated-vm-docker-image-deploy, otel-collector-docker-image-deploy, probe-docker-image-deploy, status-page-docker-image-deploy, test-docker-image-deploy, test-server-docker-image-deploy, publish-npm-packages, e2e-docker-image-deploy, helm-chart-deploy, generate-build-number, nginx-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: npm run prerun
- name: Start Server with release tag
run: npm run start
- name: Wait for server to start
run: bash ./Tests/Scripts/status-check.sh http://localhost
- name: Run E2E Tests. Run docker container e2e in docker compose file
run: export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker compose -f docker-compose.dev.yml logs e2e && exit 1)
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this on failure
if: failure()
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: test-results
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
./E2E
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 7
github-release:
needs: [test-e2e-release-saas, test-e2e-release-self-hosted, generate-build-number]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release'
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- run: echo "${{needs.generate-build-number.outputs.build_number}}"
- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4.2.0
with:
configuration: "./Scripts/Release/ChangelogConfig.json"
- run: echo "Changelog:"
- run: echo "${{steps.build_changelog.outputs.changelog}}"
- uses: ncipollo/release-action@v1
with:
tag: "7.0.${{needs.generate-build-number.outputs.build_number}}"
artifactErrorsFailBuild: true
body: |
${{steps.build_changelog.outputs.changelog}}
infrastructure-agent-deploy:
needs: [generate-build-number, github-release]
needs: [github-release, generate-build-number]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -983,3 +1240,5 @@ jobs:
draft: false
prerelease: false
tag_name: 7.0.${{needs.generate-build-number.outputs.build_number}}

View File

@@ -0,0 +1,32 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
name: "OneUptime Reliability Copilot"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'
jobs:
analyze:
name: Analyze Code
runs-on: ubuntu-latest
steps:
# Run Reliability Copilot in Doker Container
- name: Run Copilot
run: |
docker run --rm \
-e ONEUPTIME_URL="https://test.oneuptime.com" \
-e ONEUPTIME_REPOSITORY_SECRET_KEY="${{ secrets.COPILOT_ONEUPTIME_REPOSITORY_SECRET_KEY }}" \
-e CODE_REPOSITORY_PASSWORD="${{ github.token }}" \
-e CODE_REPOSITORY_USERNAME="simlarsen" \
-e OPENAI_API_KEY="${{ secrets.OPENAI_API_KEY }}" \
--net=host oneuptime/copilot:test

View File

@@ -6,6 +6,7 @@ on:
- "master"
jobs:
generate-build-number:
runs-on: ubuntu-latest
outputs:
@@ -18,6 +19,92 @@ jobs:
token: ${{secrets.github_token}}
- run: echo "Build number is ${{ steps.buildnumber.outputs.build_number }}"
llm-docker-image-deploy:
needs: generate-build-number
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
oneuptime/llm
ghcr.io/oneuptime/llm
tags: |
type=raw,value=test,enable=true
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
# - name: Setup Git LFS
# run: git lfs install
# # Cannot do this, no space on the gitHub standard runner. We need to use the large runner which is selfhosted
# - name: Download the Model from Hugging Face
# run: mkdir -p ./LLM/Models && cd ./LLM/Models && git clone https://${{ secrets.HUGGING_FACE_USERNAME }}:${{ secrets.HUGGING_FACE_PASSWORD }}@huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate Dockerfile from Dockerfile.tpl
run: npm run prerun
# Build and deploy nginx.
- name: Login to Docker Hub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./LLM/Dockerfile
context: ./LLM
# arm64 is not supported by the base image of the LLM
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
nginx-docker-image-deploy:
needs: generate-build-number
@@ -876,10 +963,72 @@ jobs:
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
copilot-docker-image-deploy:
needs: generate-build-number
runs-on: ubuntu-latest
steps:
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
oneuptime/copilot
ghcr.io/oneuptime/copilot
tags: |
type=raw,value=test,enable=true
type=semver,value=7.0.${{needs.generate-build-number.outputs.build_number}}-test,pattern={{version}},enable=true
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Generate Dockerfile from Dockerfile.tpl
run: npm run prerun
# Build and deploy accounts.
- name: Login to Docker Hub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
file: ./Copilot/Dockerfile
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GIT_SHA=${{ github.sha }}
APP_VERSION=7.0.${{needs.generate-build-number.outputs.build_number}}
test-helm-chart:
runs-on: ubuntu-latest
needs: [isolated-vm-docker-image-deploy, test-server-docker-image-deploy, test-docker-image-deploy, ingestor-docker-image-deploy, probe-docker-image-deploy, haraka-docker-image-deploy, dashboard-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, accounts-docker-image-deploy, otel-collector-docker-image-deploy, status-page-docker-image-deploy, nginx-docker-image-deploy, e2e-docker-image-deploy]
needs: [llm-docker-image-deploy, copilot-docker-image-deploy, isolated-vm-docker-image-deploy, test-server-docker-image-deploy, test-docker-image-deploy, ingestor-docker-image-deploy, probe-docker-image-deploy, haraka-docker-image-deploy, dashboard-docker-image-deploy, admin-dashboard-docker-image-deploy, app-docker-image-deploy, accounts-docker-image-deploy, otel-collector-docker-image-deploy, status-page-docker-image-deploy, nginx-docker-image-deploy, e2e-docker-image-deploy]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
@@ -888,3 +1037,111 @@ jobs:
with:
node-version: 18.3.0
- run: cd HelmChart && cd Tests && bash index.sh
test-e2e-test-saas:
runs-on: ubuntu-latest
needs: [test-helm-chart]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: npm run prerun && bash ./Tests/Scripts/change-release-to-test-tag.sh
- name: Start Server with release tag
run: npm run start
- name: Wait for server to start
run: bash ./Tests/Scripts/status-check.sh http://localhost
- name: Run E2E Tests. Run docker container e2e in docker compose file
run: export $(grep -v '^#' config.env | xargs) && docker-compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker-compose -f docker-compose.dev.yml logs e2e && exit 1)
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this on failure
if: failure()
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: test-results
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
./E2E
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 7
test-e2e-test-self-hosted:
runs-on: ubuntu-latest
# After all the jobs runs
needs: [test-helm-chart]
env:
CI_PIPELINE_ID: ${{github.run_number}}
steps:
# Docker compose needs a lot of space to build images, so we need to free up some space first in the GitHub Actions runner
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 18.3.0
- run: npm run prerun && bash ./Tests/Scripts/change-release-to-test-tag.sh
- name: Start Server with release tag
run: npm run start
- name: Wait for server to start
run: bash ./Tests/Scripts/status-check.sh http://localhost
- name: Run E2E Tests. Run docker container e2e in docker compose file
run: export $(grep -v '^#' config.env | xargs) && docker-compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker-compose -f docker-compose.dev.yml logs e2e && exit 1)
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this on failure
if: failure()
with:
# Name of the artifact to upload.
# Optional. Default is 'artifact'
name: test-results
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
./E2E
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 7

View File

@@ -33,9 +33,9 @@ jobs:
- run: npm run prerun && bash ./Tests/Scripts/enable-billing-env-var.sh
- run: npm run dev
- name: Wait for server to start
run: bash ./Tests/Scripts/status-check.sh http://localhost
run: bash ./Tests/Scripts/status-check.sh http://localhost
- name: Run E2E Tests. Run docker container e2e in docker compose file
run: export $(grep -v '^#' config.env | xargs) && docker-compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker-compose -f docker-compose.dev.yml logs e2e && exit 1)
run: export $(grep -v '^#' config.env | xargs) && docker compose -f docker-compose.dev.yml up --exit-code-from e2e --abort-on-container-exit e2e || (docker compose -f docker-compose.dev.yml logs e2e && exit 1)
- name: Upload test results
uses: actions/upload-artifact@v4
# Run this on failure
@@ -48,15 +48,11 @@ jobs:
# A file, directory or wildcard pattern that describes what to upload
# Required.
path: |
./E2E/playwright-report
./E2E/test-results
./E2E
# Duration after which artifact will expire in days. 0 means using default retention.
# Minimum 1 day.
# Maximum 90 days unless changed from the repository settings page.
# Optional. Defaults to repository settings.
retention-days: 7
retention-days: 7

5
.gitignore vendored
View File

@@ -93,10 +93,9 @@ Haraka/dkim/keys/public_base64.txt
HelmChart/Values/*.values.yaml
Llama/Models/tokenizer*
Llama/Models/llama*
LLM/__pycache__/*
Llama/__pycache__/*
LLM/Models/*
Examples/otel-dotnet/obj/*

15
.oneuptime/README.md Normal file
View File

@@ -0,0 +1,15 @@
## OneUptime Copilot
This folder contains the configuration files for the OneUptime Copilot. The Copilot is a tool that automatically improves your code. It can fix issues, improve code quality, and help you ship faster.
This folder has the following structure:
- `config.js`: The configuration file for the Copilot. You can customize the Copilot's behavior by changing this file.
- `scripts`: A folder containing scripts that the Copilot runs. These are hooks that run at different stages of the Copilot's process.
- `on-after-clone.sh`: A script that runs after the Copilot clones your repository.
- `on-before-code-change.sh`: A script that runs before the Copilot makes changes to your code.
- `on-after-code-change.sh`: A script that runs after the Copilot makes changes to your code.
- `on-before-commit.sh`: A script that runs before the Copilot commits changes to your repository.
- `on-after-commit.sh`: A script that runs after the Copilot commits changes to your repository.

10
.oneuptime/config.js Normal file
View File

@@ -0,0 +1,10 @@
// This is the configuration file for the oneuptime copilot.
const getCopilotConfig = () => {
return {
// The version of the schema for this configuration file.
schemaVersion: '1.0',
}
}
export default getCopilotConfig;

View File

@@ -0,0 +1,16 @@
# Description: Copilot clones your repository and to improve your code.
# This scirpt runs after the clone process is completed.
# Some of the common tasks you can do here are:
# 1. Install dependencies
# 2. Run linting
# 3. Run tests
# 4. Run build
# 5. Run any other command that you want to run after the clone process is completed.
# If this script fails, copilot will not proceed with the next steps to improve your code.
# This step is to ensure that the code is in a good state before we start improving it.
# If you want to skip this script, you can keep this file empty.
# It's highly recommended to run linting and tests in this script to ensure the code is in a good state.
# This scirpt will run on ubuntu machine. So, make sure the commands you run are compatible with ubuntu.
npm install
npm run lint

View File

@@ -0,0 +1,13 @@
# Description: Copilot will run this script after we make improvements to your code and write it to disk.
# Some of the common tasks you can do here are:
# 1. Run linting
# 2. Run tests
# 3. Run build
# 4. Run any other command that you want to run after the code is changed.
# If this script fails, copilot will not commit the changes to your repository.
# This step is to ensure that the code is in a good state before we commit the changes.
# If you want to skip this script, you can keep this file empty.
# It's highly recommended to run linting and tests in this script to ensure the code is in a good state.
# This scirpt will run on ubuntu machine. So, make sure the commands you run are compatible with ubuntu.
npm run fix

View File

@@ -0,0 +1 @@
# Description: Copilot will run this script after the commit process is completed.

View File

@@ -0,0 +1,9 @@
# Description: Copilot will run this script before we make changes to your code.
# Some of the common tasks you can do here are:
# 1. Install dependencies
# 2. Run any other command that you want to run before the code is changed.
# If this script fails, copilot will not make any changes to the code.
# This step is to ensure that the code is in a good state before we start making changes.
# If you want to skip this script, you can keep this file empty.
# It's highly recommended to run things like installing dependencies in this script.
# This scirpt will run on ubuntu machine. So, make sure the commands you run are compatible with ubuntu.

View File

@@ -0,0 +1 @@
# Description: Copilot will run this script before we commit the changes to your repository.

View File

@@ -1,12 +0,0 @@
{
"trailingComma": "es5",
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true,
"importOrderParserPlugins": ["typescript", "decorators", "dynamicImport", "jsx"]
}

14
.vscode/launch.json vendored
View File

@@ -19,6 +19,20 @@
}
],
"configurations": [
{
"address": "127.0.0.1",
"localRoot": "${workspaceFolder}/TestServer",
"name": "Copilot: Debug with Docker",
"port": 9985,
"remoteRoot": "/usr/src/app",
"request": "attach",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"restart": true,
"autoAttachChildProcesses": true
},
{
"name": "Debug Infrastructure Agent",
"type": "go",

View File

@@ -1,37 +1,37 @@
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
import logger from 'CommonServer/Utils/Logger';
import App from 'CommonServer/Utils/StartServer';
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import Express, { ExpressApplication } from "CommonServer/Utils/Express";
import logger from "CommonServer/Utils/Logger";
import App from "CommonServer/Utils/StartServer";
export const APP_NAME: string = 'accounts';
export const APP_NAME: string = "accounts";
const app: ExpressApplication = Express.getExpressApp();
const init: PromiseVoidFunction = async (): Promise<void> => {
try {
// init the app
await App.init({
appName: APP_NAME,
port: undefined,
isFrontendApp: true,
statusOptions: {
liveCheck: async () => {},
readyCheck: async () => {},
},
});
// add default routes
await App.addDefaultRoutes();
} catch (err) {
logger.error('App Init Failed:');
logger.error(err);
throw err;
}
try {
// init the app
await App.init({
appName: APP_NAME,
port: undefined,
isFrontendApp: true,
statusOptions: {
liveCheck: async () => {},
readyCheck: async () => {},
},
});
// add default routes
await App.addDefaultRoutes();
} catch (err) {
logger.error("App Init Failed:");
logger.error(err);
throw err;
}
};
init().catch((err: Error) => {
logger.error(err);
logger.error('Exiting node process');
process.exit(1);
logger.error(err);
logger.error("Exiting node process");
process.exit(1);
});
export default app;

8
Accounts/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
declare module '*.png';
declare module '*.svg';
declare module '*.jpg';
declare module '*.gif';
declare module "*.png";
declare module "*.svg";
declare module "*.jpg";
declare module "*.gif";

View File

@@ -1,47 +1,47 @@
import ForgotPasswordPage from './Pages/ForgotPassword';
import LoginPage from './Pages/Login';
import NotFound from './Pages/NotFound';
import RegisterPage from './Pages/Register';
import ResetPasswordPage from './Pages/ResetPassword';
import VerifyEmail from './Pages/VerifyEmail';
import Navigation from 'CommonUI/src/Utils/Navigation';
import React, { ReactElement } from 'react';
import ForgotPasswordPage from "./Pages/ForgotPassword";
import LoginPage from "./Pages/Login";
import LoginWithSSO from "./Pages/LoginWithSSO";
import NotFound from "./Pages/NotFound";
import RegisterPage from "./Pages/Register";
import ResetPasswordPage from "./Pages/ResetPassword";
import VerifyEmail from "./Pages/VerifyEmail";
import Navigation from "CommonUI/src/Utils/Navigation";
import React, { ReactElement } from "react";
import {
Route,
Routes,
useLocation,
useNavigate,
useParams,
} from 'react-router-dom';
Route,
Routes,
useLocation,
useNavigate,
useParams,
} from "react-router-dom";
function App(): ReactElement {
Navigation.setNavigateHook(useNavigate());
Navigation.setLocation(useLocation());
Navigation.setParams(useParams());
Navigation.setNavigateHook(useNavigate());
Navigation.setLocation(useLocation());
Navigation.setParams(useParams());
return (
<div className="m-auto h-screen">
<Routes>
<Route path="/accounts" element={<LoginPage />} />
<Route path="/accounts/login" element={<LoginPage />} />
<Route
path="/accounts/forgot-password"
element={<ForgotPasswordPage />}
/>
<Route
path="/accounts/reset-password/:token"
element={<ResetPasswordPage />}
/>
<Route path="/accounts/register" element={<RegisterPage />} />
<Route
path="/accounts/verify-email/:token"
element={<VerifyEmail />}
/>
{/* 👇️ only match this when no other routes match */}
<Route path="*" element={<NotFound />} />
</Routes>
</div>
);
return (
<div className="m-auto h-screen">
<Routes>
<Route path="/accounts" element={<LoginPage />} />
<Route path="/accounts/login" element={<LoginPage />} />
<Route path="/accounts/sso" element={<LoginWithSSO />} />
<Route
path="/accounts/forgot-password"
element={<ForgotPasswordPage />}
/>
<Route
path="/accounts/reset-password/:token"
element={<ResetPasswordPage />}
/>
<Route path="/accounts/register" element={<RegisterPage />} />
<Route path="/accounts/verify-email/:token" element={<VerifyEmail />} />
{/* 👇️ only match this when no other routes match */}
<Route path="*" element={<NotFound />} />
</Routes>
</div>
);
}
export default App;

View File

@@ -1,20 +1,20 @@
import React from 'react';
import { Link } from 'react-router-dom';
import React from "react";
import { Link } from "react-router-dom";
const Footer: () => JSX.Element = () => {
return (
<div className="footer">
<p>
<Link to="/">&copy; OneUptime</Link>
</p>
<p>
<Link to="/">Contact</Link>
</p>
<p>
<Link to="/">Privacy &amp; terms</Link>
</p>
</div>
);
return (
<div className="footer">
<p>
<Link to="/">&copy; OneUptime</Link>
</p>
<p>
<Link to="/">Contact</Link>
</p>
<p>
<Link to="/">Privacy &amp; terms</Link>
</p>
</div>
);
};
export default Footer;

View File

@@ -1,19 +1,19 @@
import App from './App';
import Telemetry from 'CommonUI/src/Utils/Telemetry';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from "./App";
import Telemetry from "CommonUI/src/Utils/Telemetry";
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
Telemetry.init({
serviceName: 'Accounts',
serviceName: "Accounts",
});
const root: any = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
document.getElementById("root") as HTMLElement,
);
root.render(
<BrowserRouter>
<App />
</BrowserRouter>
<BrowserRouter>
<App />
</BrowserRouter>,
);

View File

@@ -1,99 +1,99 @@
import { FORGOT_PASSWORD_API_URL } from '../Utils/ApiPaths';
import Route from 'Common/Types/API/Route';
import URL from 'Common/Types/API/URL';
import ModelForm, { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import Link from 'CommonUI/src/Components/Link/Link';
import OneUptimeLogo from 'CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg';
import User from 'Model/Models/User';
import React, { useState } from 'react';
import { FORGOT_PASSWORD_API_URL } from "../Utils/ApiPaths";
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import ModelForm, { FormType } from "CommonUI/src/Components/Forms/ModelForm";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import Link from "CommonUI/src/Components/Link/Link";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import User from "Model/Models/User";
import React, { useState } from "react";
const ForgotPassword: () => JSX.Element = () => {
const apiUrl: URL = FORGOT_PASSWORD_API_URL;
const apiUrl: URL = FORGOT_PASSWORD_API_URL;
const [isSuccess, setIsSuccess] = useState<boolean>(false);
const [isSuccess, setIsSuccess] = useState<boolean>(false);
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="Your Company"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Forgot your password
</h2>
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="Your Company"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Forgot your password
</h2>
{!isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
Please enter your email and the password reset link will
be sent to you.
</p>
)}
{!isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
Please enter your email and the password reset link will be sent to
you.
</p>
)}
{isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
We have emailed you the password reset link. Please do
not forget to check spam.
</p>
)}
</div>
{isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
We have emailed you the password reset link. Please do not forget to
check spam.
</p>
)}
</div>
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
{!isSuccess && (
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
name="Forgot Password"
id="login-form"
createOrUpdateApiUrl={apiUrl}
fields={[
{
field: {
email: true,
},
title: 'Email',
fieldType: FormFieldSchemaType.Email,
required: true,
},
]}
onSuccess={() => {
setIsSuccess(true);
}}
submitButtonText={'Send Password Reset Link'}
formType={FormType.Create}
maxPrimaryButtonWidth={true}
footer={
<div className="actions pointer text-center mt-4 hover:underline fw-semibold">
<p>
<Link
to={new Route('/accounts/login')}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer text-sm"
>
Return to Sign in.
</Link>
</p>
</div>
}
/>
</div>
)}
<div className="mt-5 text-center">
<p className="text-muted mb-0 text-gray-500">
Remember your password?{' '}
<Link
to={new Route('/accounts/login')}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Login.
</Link>
</p>
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
{!isSuccess && (
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
name="Forgot Password"
id="login-form"
createOrUpdateApiUrl={apiUrl}
fields={[
{
field: {
email: true,
},
title: "Email",
fieldType: FormFieldSchemaType.Email,
required: true,
},
]}
onSuccess={() => {
setIsSuccess(true);
}}
submitButtonText={"Send Password Reset Link"}
formType={FormType.Create}
maxPrimaryButtonWidth={true}
footer={
<div className="actions pointer text-center mt-4 hover:underline fw-semibold">
<p>
<Link
to={new Route("/accounts/login")}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer text-sm"
>
Return to Sign in.
</Link>
</p>
</div>
</div>
}
/>
</div>
)}
<div className="mt-5 text-center">
<p className="text-muted mb-0 text-gray-500">
Remember your password?{" "}
<Link
to={new Route("/accounts/login")}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Login.
</Link>
</p>
</div>
);
</div>
</div>
);
};
export default ForgotPassword;

View File

@@ -1,167 +1,132 @@
import { LOGIN_API_URL } from '../Utils/ApiPaths';
import Route from 'Common/Types/API/Route';
import URL from 'Common/Types/API/URL';
import { JSONObject } from 'Common/Types/JSON';
import Alert, { AlertType } from 'CommonUI/src/Components/Alerts/Alert';
import ModelForm, { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import Link from 'CommonUI/src/Components/Link/Link';
import { DASHBOARD_URL } from 'CommonUI/src/Config';
import OneUptimeLogo from 'CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg';
import UiAnalytics from 'CommonUI/src/Utils/Analytics';
import LoginUtil from 'CommonUI/src/Utils/Login';
import Navigation from 'CommonUI/src/Utils/Navigation';
import UserUtil from 'CommonUI/src/Utils/User';
import User from 'Model/Models/User';
import React, { useState } from 'react';
import useAsyncEffect from 'use-async-effect';
import { LOGIN_API_URL } from "../Utils/ApiPaths";
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import { JSONObject } from "Common/Types/JSON";
import ModelForm, { FormType } from "CommonUI/src/Components/Forms/ModelForm";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import Link from "CommonUI/src/Components/Link/Link";
import { DASHBOARD_URL } from "CommonUI/src/Config";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import UiAnalytics from "CommonUI/src/Utils/Analytics";
import LoginUtil from "CommonUI/src/Utils/Login";
import Navigation from "CommonUI/src/Utils/Navigation";
import UserUtil from "CommonUI/src/Utils/User";
import User from "Model/Models/User";
import React from "react";
import useAsyncEffect from "use-async-effect";
const LoginPage: () => JSX.Element = () => {
const apiUrl: URL = LOGIN_API_URL;
const apiUrl: URL = LOGIN_API_URL;
if (UserUtil.isLoggedIn()) {
Navigation.navigate(DASHBOARD_URL);
if (UserUtil.isLoggedIn()) {
Navigation.navigate(DASHBOARD_URL);
}
const [initialValues, setInitialValues] = React.useState<JSONObject>({});
useAsyncEffect(async () => {
if (Navigation.getQueryStringByName("email")) {
setInitialValues({
email: Navigation.getQueryStringByName("email"),
});
}
}, []);
const showSsoMessage: boolean = Boolean(
Navigation.getQueryStringByName('sso')
);
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="OneUptime"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Sign in to your account
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Join thousands of business that use OneUptime to help them stay online
all the time.
</p>
</div>
const [showSsoTip, setShowSSOTip] = useState<boolean>(false);
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
id="login-form"
name="Login"
fields={[
{
field: {
email: true,
},
fieldType: FormFieldSchemaType.Email,
placeholder: "jeff@example.com",
required: true,
disabled: Boolean(initialValues && initialValues["email"]),
title: "Email",
dataTestId: "email",
},
{
field: {
password: true,
},
title: "Password",
required: true,
validation: {
minLength: 6,
},
fieldType: FormFieldSchemaType.Password,
sideLink: {
text: "Forgot password?",
url: new Route("/accounts/forgot-password"),
openLinkInNewTab: false,
},
dataTestId: "password",
},
]}
createOrUpdateApiUrl={apiUrl}
formType={FormType.Create}
submitButtonText={"Login"}
onSuccess={(value: User, miscData: JSONObject | undefined) => {
if (value && value.email) {
UiAnalytics.userAuth(value.email);
UiAnalytics.capture("accounts/login");
}
const [initialValues, setInitialValues] = React.useState<JSONObject>({});
useAsyncEffect(async () => {
if (Navigation.getQueryStringByName('email')) {
setInitialValues({
email: Navigation.getQueryStringByName('email'),
});
}
}, []);
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="OneUptime"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Sign in to your account
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Join thousands of business that use OneUptime to help them
stay online all the time.
</p>
</div>
{showSsoMessage && (
<div className="sm:mx-auto sm:w-full sm:max-w-md mt-8">
{' '}
<Alert
type={AlertType.DANGER}
title="You must be logged into OneUptime account to use single sign-on (SSO) for your project. Logging in to OneUptime account and single sign on (SSO) for your project are two separate steps. Please use the form below to log in to your OneUptime account before you use SSO."
/>{' '}
</div>
)}
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
id="login-form"
name="Login"
fields={[
{
field: {
email: true,
},
fieldType: FormFieldSchemaType.Email,
placeholder: 'jeff@example.com',
required: true,
disabled: Boolean(
initialValues && initialValues['email']
),
title: 'Email',
dataTestId: 'email',
},
{
field: {
password: true,
},
title: 'Password',
required: true,
validation: {
minLength: 6,
},
fieldType: FormFieldSchemaType.Password,
sideLink: {
text: 'Forgot password?',
url: new Route('/accounts/forgot-password'),
openLinkInNewTab: false,
},
dataTestId: 'password',
},
]}
createOrUpdateApiUrl={apiUrl}
formType={FormType.Create}
submitButtonText={'Login'}
onSuccess={(
value: User,
miscData: JSONObject | undefined
) => {
if (value && value.email) {
UiAnalytics.userAuth(value.email);
UiAnalytics.capture('accounts/login');
}
LoginUtil.login({
user: value,
token: miscData ? miscData['token'] : undefined,
});
}}
maxPrimaryButtonWidth={true}
footer={
<div className="actions text-center mt-4 hover:underline fw-semibold">
<div>
{!showSsoTip && (
<div
onClick={() => {
setShowSSOTip(true);
}}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer text-sm"
>
Use single sign-on (SSO) instead
</div>
)}
{showSsoTip && (
<div className="text-gray-500 text-sm">
Please sign in with your SSO
provider like Okta, Auth0, Entra ID
or any other SAML 2.0 provider.
</div>
)}
</div>
</div>
}
/>
</div>
<div className="mt-10 text-center">
<div className="text-muted mb-0 text-gray-500">
Don&apos;t have an account?{' '}
<Link
to={new Route('/accounts/register')}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Register.
</Link>
LoginUtil.login({
user: value,
token: miscData ? miscData["token"] : undefined,
});
}}
maxPrimaryButtonWidth={true}
footer={
<div className="actions text-center mt-4 hover:underline fw-semibold">
<div>
<Link to={new Route("/accounts/sso")}>
<div className="text-indigo-500 hover:text-indigo-900 cursor-pointer text-sm">
Use single sign-on (SSO) instead
</div>
</Link>
</div>
</div>
</div>
}
/>
</div>
);
<div className="mt-10 text-center">
<div className="text-muted mb-0 text-gray-500">
Don&apos;t have an account?{" "}
<Link
to={new Route("/accounts/register")}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Register.
</Link>
</div>
</div>
</div>
</div>
);
};
export default LoginPage;

View File

@@ -0,0 +1,235 @@
import { SERVICE_PROVIDER_LOGIN_URL } from "../Utils/ApiPaths";
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import { JSONArray, JSONObject } from "Common/Types/JSON";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import Link from "CommonUI/src/Components/Link/Link";
import { DASHBOARD_URL, IDENTITY_URL } from "CommonUI/src/Config";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import Navigation from "CommonUI/src/Utils/Navigation";
import UserUtil from "CommonUI/src/Utils/User";
import User from "Model/Models/User";
import React, { ReactElement, useState } from "react";
import ProjectSSO from "Model/Models/ProjectSso";
import PageLoader from "CommonUI/src/Components/Loader/PageLoader";
import API from "CommonUI/src/Utils/API/API";
import BasicForm from "CommonUI/src/Components/Forms/BasicForm";
import Email from "Common/Types/Email";
import HTTPErrorResponse from "Common/Types/API/HTTPErrorResponse";
import HTTPResponse from "Common/Types/API/HTTPResponse";
import StaticModelList from "CommonUI/src/Components/ModelList/StaticModelList";
const LoginPage: () => JSX.Element = () => {
const apiUrl: URL = SERVICE_PROVIDER_LOGIN_URL;
if (UserUtil.isLoggedIn()) {
Navigation.navigate(DASHBOARD_URL);
}
const [error, setError] = useState<string | undefined>(undefined);
const [isLoading, setIsLoading] = useState<boolean>(false);
const [projectSsoConfigList, setProjectSsoConfigList] = useState<
Array<ProjectSSO>
>([]);
type FetchSSOConfigsFunction = (email: Email) => Promise<void>;
const fetchSsoConfigs: FetchSSOConfigsFunction = async (
email: Email,
): Promise<void> => {
if (email) {
setIsLoading(true);
try {
// get sso config by email.
const listResult: HTTPErrorResponse | HTTPResponse<JSONArray> =
await API.get(
URL.fromString(apiUrl.toString()).addQueryParam(
"email",
email.toString(),
),
);
if (listResult instanceof HTTPErrorResponse) {
throw listResult;
}
if (!listResult.data || (listResult.data as JSONArray).length === 0) {
setError(
"No SSO configuration found for the email: " + email.toString(),
);
} else {
setProjectSsoConfigList(
ProjectSSO.fromJSONArray(listResult["data"], ProjectSSO),
);
}
} catch (error) {
setError(API.getFriendlyErrorMessage(error as Error));
}
} else {
setError("Email is required to perform this action");
}
setIsLoading(false);
};
type GetSsoConfigModelListFunction = (
configs: Array<ProjectSSO>,
) => ReactElement;
const getSsoConfigModelList: GetSsoConfigModelListFunction = (
configs: Array<ProjectSSO>,
): ReactElement => {
return (
<StaticModelList<ProjectSSO>
list={configs}
titleField="name"
selectedItems={[]}
descriptionField="description"
onClick={(item: ProjectSSO) => {
setIsLoading(true);
Navigation.navigate(
URL.fromURL(IDENTITY_URL).addRoute(
new Route(
`/sso/${item.projectId?.toString()}/${item.id?.toString()}`,
),
),
);
}}
/>
);
};
if (isLoading) {
return <PageLoader isVisible={true} />;
}
type GetProjectNameFunction = (projectId: string) => string;
const getProjectName: GetProjectNameFunction = (
projectId: string,
): string => {
const projectNames: Array<string | undefined> = projectSsoConfigList
.filter((config: ProjectSSO) => {
return config.projectId?.toString() === projectId.toString();
})
.map((config: ProjectSSO) => {
return config.project?.name;
});
return projectNames[0] || "Project";
};
if (projectSsoConfigList.length > 0 && !error && !isLoading) {
const projectIds: Array<string> = projectSsoConfigList.map(
(config: ProjectSSO) => {
return config.projectId?.toString() as string;
},
);
return (
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="OneUptime"
/>
<h2 className="mt-10 text-center text-xl tracking-tight text-gray-900">
Select Project
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Select the project you want to login to.
</p>
</div>
{projectIds.map((projectId: string) => {
return (
<div key={projectId}>
<h3 className="mt-6 font-medium tracking-tight">
{getProjectName(projectId)}
</h3>
{getSsoConfigModelList(
projectSsoConfigList.filter((config: ProjectSSO) => {
return (
config.projectId?.toString() === projectId.toString()
);
}),
)}
</div>
);
})}
</div>
</div>
);
}
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="OneUptime"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Login with SSO
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Login with your SSO provider to access your account.
</p>
</div>
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<BasicForm
modelType={User}
id="login-form"
error={error}
name="Login"
fields={[
{
field: {
email: true,
},
fieldType: FormFieldSchemaType.Email,
placeholder: "jeff@example.com",
required: true,
title: "Email",
dataTestId: "email",
},
]}
maxPrimaryButtonWidth={true}
submitButtonText="Login with SSO"
onSubmit={async (data: JSONObject) => {
await fetchSsoConfigs(data["email"] as Email);
}}
footer={
<div className="actions text-center mt-4 hover:underline fw-semibold">
<div>
<Link to={new Route("/accounts/login")}>
<div className="text-indigo-500 hover:text-indigo-900 cursor-pointer text-sm">
Use username and password insead.
</div>
</Link>
</div>
</div>
}
/>
</div>
<div className="mt-10 text-center">
<div className="text-muted mb-0 text-gray-500">
Don&apos;t have an account?{" "}
<Link
to={new Route("/accounts/register")}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Register.
</Link>
</div>
</div>
</div>
</div>
);
};
export default LoginPage;

View File

@@ -1,18 +1,18 @@
import React from 'react';
import React from "react";
const LoginPage: () => JSX.Element = () => {
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Page not found
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Page you are looking for does not exist.
</p>
</div>
</div>
);
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Page not found
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Page you are looking for does not exist.
</p>
</div>
</div>
);
};
export default LoginPage;

View File

@@ -1,276 +1,267 @@
import { SIGNUP_API_URL } from '../Utils/ApiPaths';
import Route from 'Common/Types/API/Route';
import URL from 'Common/Types/API/URL';
import Dictionary from 'Common/Types/Dictionary';
import { JSONObject } from 'Common/Types/JSON';
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import ModelForm, { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
import Fields from 'CommonUI/src/Components/Forms/Types/Fields';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import Link from 'CommonUI/src/Components/Link/Link';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import { BILLING_ENABLED, DASHBOARD_URL } from 'CommonUI/src/Config';
import OneUptimeLogo from 'CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg';
import BaseAPI from 'CommonUI/src/Utils/API/API';
import UiAnalytics from 'CommonUI/src/Utils/Analytics';
import LocalStorage from 'CommonUI/src/Utils/LocalStorage';
import LoginUtil from 'CommonUI/src/Utils/Login';
import ModelAPI, { ListResult } from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import Navigation from 'CommonUI/src/Utils/Navigation';
import UserUtil from 'CommonUI/src/Utils/User';
import Reseller from 'Model/Models/Reseller';
import User from 'Model/Models/User';
import React, { useState } from 'react';
import useAsyncEffect from 'use-async-effect';
import { SIGNUP_API_URL } from "../Utils/ApiPaths";
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import Dictionary from "Common/Types/Dictionary";
import { JSONObject } from "Common/Types/JSON";
import ErrorMessage from "CommonUI/src/Components/ErrorMessage/ErrorMessage";
import ModelForm, { FormType } from "CommonUI/src/Components/Forms/ModelForm";
import Fields from "CommonUI/src/Components/Forms/Types/Fields";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import Link from "CommonUI/src/Components/Link/Link";
import PageLoader from "CommonUI/src/Components/Loader/PageLoader";
import { BILLING_ENABLED, DASHBOARD_URL } from "CommonUI/src/Config";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import BaseAPI from "CommonUI/src/Utils/API/API";
import UiAnalytics from "CommonUI/src/Utils/Analytics";
import LocalStorage from "CommonUI/src/Utils/LocalStorage";
import LoginUtil from "CommonUI/src/Utils/Login";
import ModelAPI, { ListResult } from "CommonUI/src/Utils/ModelAPI/ModelAPI";
import Navigation from "CommonUI/src/Utils/Navigation";
import UserUtil from "CommonUI/src/Utils/User";
import Reseller from "Model/Models/Reseller";
import User from "Model/Models/User";
import React, { useState } from "react";
import useAsyncEffect from "use-async-effect";
const RegisterPage: () => JSX.Element = () => {
const apiUrl: URL = SIGNUP_API_URL;
const apiUrl: URL = SIGNUP_API_URL;
const [initialValues, setInitialValues] = React.useState<JSONObject>({});
const [initialValues, setInitialValues] = React.useState<JSONObject>({});
const [error, setError] = useState<string>('');
const [error, setError] = useState<string>("");
const [isLoading, setIsLoading] = React.useState<boolean>(false);
const [isLoading, setIsLoading] = React.useState<boolean>(false);
const [reseller, setResller] = React.useState<Reseller | undefined>(
undefined
);
const [reseller, setResller] = React.useState<Reseller | undefined>(
undefined,
);
if (UserUtil.isLoggedIn()) {
Navigation.navigate(DASHBOARD_URL);
if (UserUtil.isLoggedIn()) {
Navigation.navigate(DASHBOARD_URL);
}
type FetchResellerFunction = (resellerId: string) => Promise<void>;
const fetchReseller: FetchResellerFunction = async (
resellerId: string,
): Promise<void> => {
setIsLoading(true);
try {
const reseller: ListResult<Reseller> = await ModelAPI.getList<Reseller>({
modelType: Reseller,
query: {
resellerId: resellerId,
},
limit: 1,
skip: 0,
select: {
hidePhoneNumberOnSignup: true,
},
sort: {},
requestOptions: {},
});
if (reseller.data.length > 0) {
setResller(reseller.data[0]);
}
} catch (err) {
setError(BaseAPI.getFriendlyMessage(err));
}
type FetchResellerFunction = (resellerId: string) => Promise<void>;
setIsLoading(false);
};
const fetchReseller: FetchResellerFunction = async (
resellerId: string
): Promise<void> => {
setIsLoading(true);
try {
const reseller: ListResult<Reseller> =
await ModelAPI.getList<Reseller>({
modelType: Reseller,
query: {
resellerId: resellerId,
},
limit: 1,
skip: 0,
select: {
hidePhoneNumberOnSignup: true,
},
sort: {},
requestOptions: {},
});
if (reseller.data.length > 0) {
setResller(reseller.data[0]);
}
} catch (err) {
setError(BaseAPI.getFriendlyMessage(err));
}
setIsLoading(false);
};
useAsyncEffect(async () => {
// if promo code is found, please save it in localstorage.
if (Navigation.getQueryStringByName('promoCode')) {
LocalStorage.setItem(
'promoCode',
Navigation.getQueryStringByName('promoCode')
);
}
if (Navigation.getQueryStringByName('email')) {
setInitialValues({
email: Navigation.getQueryStringByName('email'),
});
}
// if promo code is found, please save it in localstorage.
if (Navigation.getQueryStringByName('partnerId')) {
await fetchReseller(Navigation.getQueryStringByName('partnerId')!);
}
}, []);
let formFields: Fields<User> = [
{
field: {
email: true,
},
fieldType: FormFieldSchemaType.Email,
placeholder: 'jeff@example.com',
required: true,
disabled: Boolean(initialValues && initialValues['email']),
title: 'Email',
dataTestId: 'email',
},
{
field: {
name: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: 'Jeff Smith',
required: true,
title: 'Full Name',
dataTestId: 'name',
},
];
if (BILLING_ENABLED) {
formFields = formFields.concat([
{
field: {
companyName: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: 'Acme, Inc.',
required: true,
title: 'Company Name',
dataTestId: 'companyName',
},
]);
// If reseller wants to hide phone number on sign up, we hide it.
if (!reseller || !reseller.hidePhoneNumberOnSignup) {
formFields.push({
field: {
companyPhoneNumber: true,
},
fieldType: FormFieldSchemaType.Phone,
required: true,
placeholder: '+11234567890',
title: 'Phone Number',
dataTestId: 'companyPhoneNumber',
});
}
useAsyncEffect(async () => {
// if promo code is found, please save it in localstorage.
if (Navigation.getQueryStringByName("promoCode")) {
LocalStorage.setItem(
"promoCode",
Navigation.getQueryStringByName("promoCode"),
);
}
if (Navigation.getQueryStringByName("email")) {
setInitialValues({
email: Navigation.getQueryStringByName("email"),
});
}
// if promo code is found, please save it in localstorage.
if (Navigation.getQueryStringByName("partnerId")) {
await fetchReseller(Navigation.getQueryStringByName("partnerId")!);
}
}, []);
let formFields: Fields<User> = [
{
field: {
email: true,
},
fieldType: FormFieldSchemaType.Email,
placeholder: "jeff@example.com",
required: true,
disabled: Boolean(initialValues && initialValues["email"]),
title: "Email",
dataTestId: "email",
},
{
field: {
name: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: "Jeff Smith",
required: true,
title: "Full Name",
dataTestId: "name",
},
];
if (BILLING_ENABLED) {
formFields = formFields.concat([
{
field: {
password: true,
},
fieldType: FormFieldSchemaType.Password,
validation: {
minLength: 6,
},
placeholder: 'Password',
title: 'Password',
required: true,
dataTestId: 'password',
},
{
field: {
confirmPassword: true,
} as any,
validation: {
minLength: 6,
toMatchField: 'password',
},
fieldType: FormFieldSchemaType.Password,
placeholder: 'Confirm Password',
title: 'Confirm Password',
overrideFieldKey: 'confirmPassword',
required: true,
showEvenIfPermissionDoesNotExist: true,
dataTestId: 'confirmPassword',
{
field: {
companyName: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: "Acme, Inc.",
required: true,
title: "Company Name",
dataTestId: "companyName",
},
]);
if (error) {
return <ErrorMessage error={error} />;
// If reseller wants to hide phone number on sign up, we hide it.
if (!reseller || !reseller.hidePhoneNumberOnSignup) {
formFields.push({
field: {
companyPhoneNumber: true,
},
fieldType: FormFieldSchemaType.Phone,
required: true,
placeholder: "+11234567890",
title: "Phone Number",
dataTestId: "companyPhoneNumber",
});
}
}
if (isLoading) {
return <PageLoader isVisible={true} />;
}
formFields = formFields.concat([
{
field: {
password: true,
},
fieldType: FormFieldSchemaType.Password,
validation: {
minLength: 6,
},
placeholder: "Password",
title: "Password",
required: true,
dataTestId: "password",
},
{
field: {
confirmPassword: true,
} as any,
validation: {
minLength: 6,
toMatchField: "password",
},
fieldType: FormFieldSchemaType.Password,
placeholder: "Confirm Password",
title: "Confirm Password",
overrideFieldKey: "confirmPassword",
required: true,
showEvenIfPermissionDoesNotExist: true,
dataTestId: "confirmPassword",
},
]);
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="OneUptime"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Create your OneUptime account
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Join thousands of business that use OneUptime to help them
stay online all the time.
</p>
<p className="mt-2 text-center text-sm text-gray-600">
No credit card required.
</p>
</div>
if (error) {
return <ErrorMessage error={error} />;
}
<div className="mt-8 lg:mx-auto lg:w-full lg:max-w-2xl">
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
id="register-form"
showAsColumns={reseller ? 1 : 2}
name="Register"
initialValues={initialValues}
maxPrimaryButtonWidth={true}
fields={formFields}
createOrUpdateApiUrl={apiUrl}
onBeforeCreate={(item: User): Promise<User> => {
const utmParams: Dictionary<string> =
UserUtil.getUtmParams();
if (isLoading) {
return <PageLoader isVisible={true} />;
}
if (
utmParams &&
Object.keys(utmParams).length > 0
) {
item.utmSource = utmParams['utmSource'] || '';
item.utmMedium = utmParams['utmMedium'] || '';
item.utmCampaign =
utmParams['utmCampaign'] || '';
item.utmTerm = utmParams['utmTerm'] || '';
item.utmContent = utmParams['utmContent'] || '';
item.utmUrl = utmParams['utmUrl'] || '';
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="OneUptime"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Create your OneUptime account
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Join thousands of business that use OneUptime to help them stay online
all the time.
</p>
<p className="mt-2 text-center text-sm text-gray-600">
No credit card required.
</p>
</div>
UiAnalytics.capture('utm_event', utmParams);
}
<div className="mt-8 lg:mx-auto lg:w-full lg:max-w-2xl">
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
id="register-form"
showAsColumns={reseller ? 1 : 2}
name="Register"
initialValues={initialValues}
maxPrimaryButtonWidth={true}
fields={formFields}
createOrUpdateApiUrl={apiUrl}
onBeforeCreate={(item: User): Promise<User> => {
const utmParams: Dictionary<string> = UserUtil.getUtmParams();
return Promise.resolve(item);
}}
formType={FormType.Create}
submitButtonText={'Sign Up'}
onSuccess={(
value: User,
miscData: JSONObject | undefined
) => {
if (value && value.email) {
UiAnalytics.userAuth(value.email);
UiAnalytics.capture('accounts/register');
}
if (utmParams && Object.keys(utmParams).length > 0) {
item.utmSource = utmParams["utmSource"] || "";
item.utmMedium = utmParams["utmMedium"] || "";
item.utmCampaign = utmParams["utmCampaign"] || "";
item.utmTerm = utmParams["utmTerm"] || "";
item.utmContent = utmParams["utmContent"] || "";
item.utmUrl = utmParams["utmUrl"] || "";
LoginUtil.login({
user: value,
token: miscData ? miscData['token'] : undefined,
});
}}
/>
</div>
<div className="mt-5 text-center text-gray-500">
<p className="text-muted mb-0">
Already have an account?{' '}
<Link
to={new Route('/accounts/login')}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Log in.
</Link>
</p>
</div>
</div>
UiAnalytics.capture("utm_event", utmParams);
}
return Promise.resolve(item);
}}
formType={FormType.Create}
submitButtonText={"Sign Up"}
onSuccess={(value: User, miscData: JSONObject | undefined) => {
if (value && value.email) {
UiAnalytics.userAuth(value.email);
UiAnalytics.capture("accounts/register");
}
LoginUtil.login({
user: value,
token: miscData ? miscData["token"] : undefined,
});
}}
/>
</div>
);
<div className="mt-5 text-center text-gray-500">
<p className="text-muted mb-0">
Already have an account?{" "}
<Link
to={new Route("/accounts/login")}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Log in.
</Link>
</p>
</div>
</div>
</div>
);
};
export default RegisterPage;

View File

@@ -1,113 +1,114 @@
import { RESET_PASSWORD_API_URL } from '../Utils/ApiPaths';
import Route from 'Common/Types/API/Route';
import URL from 'Common/Types/API/URL';
import ModelForm, { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import Link from 'CommonUI/src/Components/Link/Link';
import OneUptimeLogo from 'CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg';
import Navigation from 'CommonUI/src/Utils/Navigation';
import User from 'Model/Models/User';
import React, { useState } from 'react';
import { RESET_PASSWORD_API_URL } from "../Utils/ApiPaths";
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import ModelForm, { FormType } from "CommonUI/src/Components/Forms/ModelForm";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import Link from "CommonUI/src/Components/Link/Link";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import Navigation from "CommonUI/src/Utils/Navigation";
import User from "Model/Models/User";
import React, { useState } from "react";
const RegisterPage: () => JSX.Element = () => {
const apiUrl: URL = RESET_PASSWORD_API_URL;
const [isSuccess, setIsSuccess] = useState<boolean>(false);
const apiUrl: URL = RESET_PASSWORD_API_URL;
const [isSuccess, setIsSuccess] = useState<boolean>(false);
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="Your Company"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Reset your password
</h2>
return (
<div className="flex min-h-full flex-col justify-center py-12 sm:px-6 lg:px-8">
<div className="sm:mx-auto sm:w-full sm:max-w-md">
<img
className="mx-auto h-12 w-auto"
src={OneUptimeLogo}
alt="Your Company"
/>
<h2 className="mt-6 text-center text-2xl tracking-tight text-gray-900">
Reset your password
</h2>
{!isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
Please enter your new password and we will have it
updated.{' '}
</p>
)}
{!isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
Please enter your new password and we will have it updated.{" "}
</p>
)}
{isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
Your password has been updated. Please log in.
</p>
)}
</div>
{isSuccess && (
<p className="mt-2 text-center text-sm text-gray-600">
Your password has been updated. Please log in.
</p>
)}
</div>
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
{!isSuccess && (
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
id="register-form"
name="Reset Password"
onBeforeCreate={(item: User): Promise<User> => {
item.resetPasswordToken =
Navigation.getLastParam()
?.toString()
.replace('/', '')
.toString() || '';
return Promise.resolve(item);
}}
showAsColumns={1}
maxPrimaryButtonWidth={true}
fields={[
{
field: {
password: true,
},
fieldType: FormFieldSchemaType.Password,
validation: {
minLength: 6,
},
placeholder: 'New Password',
title: 'New Password',
required: true,
},
{
field: {
password: true,
},
validation: {
minLength: 6,
toMatchField: 'password',
},
fieldType: FormFieldSchemaType.Password,
placeholder: 'Confirm Password',
title: 'Confirm Password',
overrideFieldKey: 'confirmPassword',
required: true,
},
]}
createOrUpdateApiUrl={apiUrl}
formType={FormType.Create}
submitButtonText={'Reset Password'}
onSuccess={() => {
setIsSuccess(true);
}}
/>
</div>
)}
<div className="mt-8 sm:mx-auto sm:w-full sm:max-w-md">
{!isSuccess && (
<div className="bg-white py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ModelForm<User>
modelType={User}
id="register-form"
name="Reset Password"
onBeforeCreate={(item: User): Promise<User> => {
item.resetPasswordToken =
Navigation.getLastParam()
?.toString()
.replace("/", "")
.toString() || "";
return Promise.resolve(item);
}}
showAsColumns={1}
maxPrimaryButtonWidth={true}
fields={[
{
field: {
password: true,
},
fieldType: FormFieldSchemaType.Password,
validation: {
minLength: 6,
},
placeholder: "New Password",
title: "New Password",
required: true,
showEvenIfPermissionDoesNotExist: true,
},
{
field: {
confirmPassword: true,
} as any,
validation: {
minLength: 6,
toMatchField: "password",
},
fieldType: FormFieldSchemaType.Password,
placeholder: "Confirm Password",
title: "Confirm Password",
overrideFieldKey: "confirmPassword",
required: true,
showEvenIfPermissionDoesNotExist: true,
},
]}
createOrUpdateApiUrl={apiUrl}
formType={FormType.Create}
submitButtonText={"Reset Password"}
onSuccess={() => {
setIsSuccess(true);
}}
/>
</div>
)}
<div className="mt-5 text-center">
<p className="text-muted mb-0 text-gray-500">
Know your password?{' '}
<Link
to={new Route('/accounts/login')}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Log in.
</Link>
</p>
</div>
</div>
<div className="mt-5 text-center">
<p className="text-muted mb-0 text-gray-500">
Know your password?{" "}
<Link
to={new Route("/accounts/login")}
className="text-indigo-500 hover:text-indigo-900 cursor-pointer"
>
Log in.
</Link>
</p>
</div>
);
</div>
</div>
);
};
export default RegisterPage;

View File

@@ -1,132 +1,121 @@
import { VERIFY_EMAIL_API_URL } from '../Utils/ApiPaths';
import Route from 'Common/Types/API/Route';
import URL from 'Common/Types/API/URL';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import ObjectID from 'Common/Types/ObjectID';
import { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
import Link from 'CommonUI/src/Components/Link/Link';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import OneUptimeLogo from 'CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg';
import API from 'CommonUI/src/Utils/API/API';
import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import Navigation from 'CommonUI/src/Utils/Navigation';
import EmailVerificationToken from 'Model/Models/EmailVerificationToken';
import React, { useEffect, useState } from 'react';
import { VERIFY_EMAIL_API_URL } from "../Utils/ApiPaths";
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import ObjectID from "Common/Types/ObjectID";
import { FormType } from "CommonUI/src/Components/Forms/ModelForm";
import Link from "CommonUI/src/Components/Link/Link";
import PageLoader from "CommonUI/src/Components/Loader/PageLoader";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import API from "CommonUI/src/Utils/API/API";
import ModelAPI from "CommonUI/src/Utils/ModelAPI/ModelAPI";
import Navigation from "CommonUI/src/Utils/Navigation";
import EmailVerificationToken from "Model/Models/EmailVerificationToken";
import React, { useEffect, useState } from "react";
const VerifyEmail: () => JSX.Element = () => {
const apiUrl: URL = VERIFY_EMAIL_API_URL;
const [error, setError] = useState<string>('');
const [isLoading, setIsLoading] = useState<boolean>(true);
const apiUrl: URL = VERIFY_EMAIL_API_URL;
const [error, setError] = useState<string>("");
const [isLoading, setIsLoading] = useState<boolean>(true);
const init: PromiseVoidFunction = async (): Promise<void> => {
// Ping an API here.
setError('');
setIsLoading(true);
const init: PromiseVoidFunction = async (): Promise<void> => {
// Ping an API here.
setError("");
setIsLoading(true);
try {
// strip data.
const emailverificationToken: EmailVerificationToken =
new EmailVerificationToken();
emailverificationToken.token = new ObjectID(
Navigation.getLastParam()?.toString().replace('/', '') || ''
);
try {
// strip data.
const emailverificationToken: EmailVerificationToken =
new EmailVerificationToken();
emailverificationToken.token = new ObjectID(
Navigation.getLastParam()?.toString().replace("/", "") || "",
);
await ModelAPI.createOrUpdate<EmailVerificationToken>({
model: emailverificationToken,
modelType: EmailVerificationToken,
formType: FormType.Create,
miscDataProps: {},
requestOptions: {
overrideRequestUrl: apiUrl,
},
});
} catch (err) {
setError(API.getFriendlyMessage(err));
}
setIsLoading(false);
};
useEffect(() => {
init().catch((err: Error) => {
setError(err.toString());
});
}, []);
if (isLoading) {
return <PageLoader isVisible={true} />;
await ModelAPI.createOrUpdate<EmailVerificationToken>({
model: emailverificationToken,
modelType: EmailVerificationToken,
formType: FormType.Create,
miscDataProps: {},
requestOptions: {
overrideRequestUrl: apiUrl,
},
});
} catch (err) {
setError(API.getFriendlyMessage(err));
}
return (
<div className="auth-page">
<div className="container-fluid p-0">
<div className="row g-0">
<div className="col-xxl-4 col-lg-4 col-md-3"></div>
setIsLoading(false);
};
<div className="col-xxl-4 col-lg-4 col-md-6">
<div className="auth-full-page-content d-flex p-sm-5 p-4">
<div className="w-100">
<div className="d-flex flex-column h-100">
<div className="auth-content my-auto">
<div
className="mt-4 text-center flex justify-center"
style={{ marginBottom: '40px' }}
>
<img
style={{ height: '50px' }}
src={`${OneUptimeLogo}`}
/>
</div>
{!error && (
<div className="text-center">
<h5 className="mb-0">
Your email is verified.
</h5>
<p className="text-muted mt-2 mb-0">
Thank you for verifying your
email. You can now log in to
OneUptime.{' '}
</p>
</div>
)}
useEffect(() => {
init().catch((err: Error) => {
setError(err.toString());
});
}, []);
{error && (
<div className="text-center">
<h5 className="mb-0">
Sorry, something went wrong!
</h5>
<p className="text-muted mt-2 mb-0">
{error}
</p>
</div>
)}
if (isLoading) {
return <PageLoader isVisible={true} />;
}
<div className="mt-5 text-center">
<p className="text-muted mb-0">
Return to sign in?{' '}
<Link
to={
new Route(
'/accounts/login'
)
}
className="hover:underline text-primary fw-semibold"
>
Login.
</Link>
</p>
</div>
</div>
</div>
</div>
</div>
return (
<div className="auth-page">
<div className="container-fluid p-0">
<div className="row g-0">
<div className="col-xxl-4 col-lg-4 col-md-3"></div>
<div className="col-xxl-4 col-lg-4 col-md-6">
<div className="auth-full-page-content d-flex p-sm-5 p-4">
<div className="w-100">
<div className="d-flex flex-column h-100">
<div className="auth-content my-auto">
<div
className="mt-4 text-center flex justify-center"
style={{ marginBottom: "40px" }}
>
<img
style={{ height: "50px" }}
src={`${OneUptimeLogo}`}
/>
</div>
{!error && (
<div className="text-center">
<h5 className="mb-0">Your email is verified.</h5>
<p className="text-muted mt-2 mb-0">
Thank you for verifying your email. You can now log in
to OneUptime.{" "}
</p>
</div>
)}
<div className="col-xxl-4 col-lg-4 col-md-3"></div>
{error && (
<div className="text-center">
<h5 className="mb-0">Sorry, something went wrong!</h5>
<p className="text-muted mt-2 mb-0">{error}</p>
</div>
)}
<div className="mt-5 text-center">
<p className="text-muted mb-0">
Return to sign in?{" "}
<Link
to={new Route("/accounts/login")}
className="hover:underline text-primary fw-semibold"
>
Login.
</Link>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="col-xxl-4 col-lg-4 col-md-3"></div>
</div>
);
</div>
</div>
);
};
export default VerifyEmail;

View File

@@ -1,22 +1,26 @@
import Route from 'Common/Types/API/Route';
import URL from 'Common/Types/API/URL';
import { IDENTITY_URL } from 'CommonUI/src/Config';
import Route from "Common/Types/API/Route";
import URL from "Common/Types/API/URL";
import { IDENTITY_URL } from "CommonUI/src/Config";
export const SIGNUP_API_URL: URL = URL.fromURL(IDENTITY_URL).addRoute(
new Route('/signup')
new Route("/signup"),
);
export const LOGIN_API_URL: URL = URL.fromURL(IDENTITY_URL).addRoute(
new Route('/login')
new Route("/login"),
);
export const SERVICE_PROVIDER_LOGIN_URL: URL = URL.fromURL(
IDENTITY_URL,
).addRoute(new Route("/service-provider-login"));
export const FORGOT_PASSWORD_API_URL: URL = URL.fromURL(IDENTITY_URL).addRoute(
new Route('/forgot-password')
new Route("/forgot-password"),
);
export const VERIFY_EMAIL_API_URL: URL = URL.fromURL(IDENTITY_URL).addRoute(
new Route('/verify-email')
new Route("/verify-email"),
);
export const RESET_PASSWORD_API_URL: URL = URL.fromURL(IDENTITY_URL).addRoute(
new Route('/reset-password')
new Route("/reset-password"),
);

View File

@@ -1,83 +1,84 @@
require('ts-loader');
require('file-loader');
require('style-loader');
require('css-loader');
require('sass-loader');
require("ts-loader");
require("file-loader");
require("style-loader");
require("css-loader");
require("sass-loader");
const path = require("path");
const webpack = require("webpack");
const dotenv = require('dotenv');
const express = require('express');
const dotenv = require("dotenv");
const express = require("express");
const readEnvFile = (pathToFile) => {
const parsed = dotenv.config({ path: pathToFile }).parsed;
const parsed = dotenv.config({ path: pathToFile }).parsed;
const env = {};
const env = {
};
for (const key in parsed) {
env[key] = JSON.stringify(parsed[key]);
}
for (const key in parsed) {
env[key] = JSON.stringify(parsed[key]);
}
return env;
}
return env;
};
module.exports = {
entry: "./src/Index.tsx",
mode: "development",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "public", "dist"),
publicPath: "/accounts/dist/",
entry: "./src/Index.tsx",
mode: "development",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "public", "dist"),
publicPath: "/accounts/dist/",
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json", ".css", ".scss"],
alias: {
react: path.resolve("./node_modules/react"),
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.css', '.scss'],
alias: {
react: path.resolve('./node_modules/react'),
}
},
externals: {
'react-native-sqlite-storage': 'react-native-sqlite-storage'
},
plugins: [
new webpack.DefinePlugin({
'process': {
'env': {
...readEnvFile('/usr/src/app/dev-env/.env')
}
}
}),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: 'ts-loader'
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', "sass-loader"]
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'file-loader'
}
],
},
devServer: {
historyApiFallback: true,
devMiddleware: {
writeToDisk: true,
},
externals: {
"react-native-sqlite-storage": "react-native-sqlite-storage",
},
plugins: [
new webpack.DefinePlugin({
process: {
env: {
...readEnvFile("/usr/src/app/dev-env/.env"),
},
allowedHosts: "all",
setupMiddlewares: (middlewares, devServer) => {
devServer.app.use('/accounts/assets', express.static(path.resolve(__dirname, 'public', 'assets')));
return middlewares;
}
},
}),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: "ts-loader",
},
{
test: /\.s[ac]ss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: "file-loader",
},
],
},
devServer: {
historyApiFallback: true,
devMiddleware: {
writeToDisk: true,
},
devtool: 'eval-source-map',
}
allowedHosts: "all",
setupMiddlewares: (middlewares, devServer) => {
devServer.app.use(
"/accounts/assets",
express.static(path.resolve(__dirname, "public", "assets")),
);
return middlewares;
},
},
devtool: "eval-source-map",
};

View File

@@ -1,38 +1,38 @@
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import Express, { ExpressApplication } from 'CommonServer/Utils/Express';
import logger from 'CommonServer/Utils/Logger';
import App from 'CommonServer/Utils/StartServer';
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import Express, { ExpressApplication } from "CommonServer/Utils/Express";
import logger from "CommonServer/Utils/Logger";
import App from "CommonServer/Utils/StartServer";
export const APP_NAME: string = 'admin';
export const APP_NAME: string = "admin";
const app: ExpressApplication = Express.getExpressApp();
const init: PromiseVoidFunction = async (): Promise<void> => {
try {
// init the app
await App.init({
appName: APP_NAME,
port: undefined,
isFrontendApp: true,
statusOptions: {
liveCheck: async () => {},
readyCheck: async () => {},
},
});
try {
// init the app
await App.init({
appName: APP_NAME,
port: undefined,
isFrontendApp: true,
statusOptions: {
liveCheck: async () => {},
readyCheck: async () => {},
},
});
// add default routes
await App.addDefaultRoutes();
} catch (err) {
logger.error('App Init Failed:');
logger.error(err);
throw err;
}
// add default routes
await App.addDefaultRoutes();
} catch (err) {
logger.error("App Init Failed:");
logger.error(err);
throw err;
}
};
init().catch((err: Error) => {
logger.error(err);
logger.error('Exiting node process');
process.exit(1);
logger.error(err);
logger.error("Exiting node process");
process.exit(1);
});
export default app;

View File

@@ -1,4 +1,4 @@
declare module '*.png';
declare module '*.svg';
declare module '*.jpg';
declare module '*.gif';
declare module "*.png";
declare module "*.svg";
declare module "*.jpg";
declare module "*.gif";

View File

@@ -1,112 +1,103 @@
import MasterPage from './Components/MasterPage/MasterPage';
import Init from './Pages/Init/Init';
import Logout from './Pages/Logout/Logout';
import Projects from './Pages/Projects/Index';
import SettingsAPIKey from './Pages/Settings/APIKey/Index';
import SettingsAuthentication from './Pages/Settings/Authentication/Index';
import SettingsCallSMS from './Pages/Settings/CallSMS/Index';
import MasterPage from "./Components/MasterPage/MasterPage";
import Init from "./Pages/Init/Init";
import Logout from "./Pages/Logout/Logout";
import Projects from "./Pages/Projects/Index";
import SettingsAPIKey from "./Pages/Settings/APIKey/Index";
import SettingsAuthentication from "./Pages/Settings/Authentication/Index";
import SettingsCallSMS from "./Pages/Settings/CallSMS/Index";
// Settings Pages.
import SettingsEmail from './Pages/Settings/Email/Index';
import SettingsProbes from './Pages/Settings/Probes/Index';
import Users from './Pages/Users/Index';
import PageMap from './Utils/PageMap';
import RouteMap from './Utils/RouteMap';
import URL from 'Common/Types/API/URL';
import { ACCOUNTS_URL, DASHBOARD_URL } from 'CommonUI/src/Config';
import Navigation from 'CommonUI/src/Utils/Navigation';
import User from 'CommonUI/src/Utils/User';
import React from 'react';
import SettingsEmail from "./Pages/Settings/Email/Index";
import SettingsProbes from "./Pages/Settings/Probes/Index";
import Users from "./Pages/Users/Index";
import PageMap from "./Utils/PageMap";
import RouteMap from "./Utils/RouteMap";
import URL from "Common/Types/API/URL";
import { ACCOUNTS_URL, DASHBOARD_URL } from "CommonUI/src/Config";
import Navigation from "CommonUI/src/Utils/Navigation";
import User from "CommonUI/src/Utils/User";
import React from "react";
import {
Route as PageRoute,
Routes,
useLocation,
useNavigate,
useParams,
} from 'react-router-dom';
Route as PageRoute,
Routes,
useLocation,
useNavigate,
useParams,
} from "react-router-dom";
const App: () => JSX.Element = () => {
Navigation.setNavigateHook(useNavigate());
Navigation.setLocation(useLocation());
Navigation.setParams(useParams());
Navigation.setNavigateHook(useNavigate());
Navigation.setLocation(useLocation());
Navigation.setParams(useParams());
if (!User.isLoggedIn()) {
if (Navigation.getQueryStringByName('sso_token')) {
Navigation.navigate(
URL.fromString(ACCOUNTS_URL.toString()).addQueryParam(
'sso',
'true'
)
);
} else {
Navigation.navigate(URL.fromString(ACCOUNTS_URL.toString()));
}
if (!User.isLoggedIn()) {
if (Navigation.getQueryStringByName("sso_token")) {
Navigation.navigate(
URL.fromString(ACCOUNTS_URL.toString()).addQueryParam("sso", "true"),
);
} else {
Navigation.navigate(URL.fromString(ACCOUNTS_URL.toString()));
}
}
if (!User.isMasterAdmin()) {
Navigation.navigate(URL.fromString(DASHBOARD_URL.toString()));
}
if (!User.isMasterAdmin()) {
Navigation.navigate(URL.fromString(DASHBOARD_URL.toString()));
}
return (
<MasterPage>
<Routes>
<PageRoute
path={RouteMap[PageMap.INIT]?.toString() || ''}
element={<Init />}
/>
return (
<MasterPage>
<Routes>
<PageRoute
path={RouteMap[PageMap.INIT]?.toString() || ""}
element={<Init />}
/>
<PageRoute
path={RouteMap[PageMap.PROJECTS]?.toString() || ''}
element={<Projects />}
/>
<PageRoute
path={RouteMap[PageMap.PROJECTS]?.toString() || ""}
element={<Projects />}
/>
<PageRoute
path={RouteMap[PageMap.USERS]?.toString() || ''}
element={<Users />}
/>
<PageRoute
path={RouteMap[PageMap.USERS]?.toString() || ""}
element={<Users />}
/>
<PageRoute
path={RouteMap[PageMap.LOGOUT]?.toString() || ''}
element={<Logout />}
/>
<PageRoute
path={RouteMap[PageMap.LOGOUT]?.toString() || ""}
element={<Logout />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS]?.toString() || ''}
element={<SettingsAuthentication />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS]?.toString() || ""}
element={<SettingsAuthentication />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_SMTP]?.toString() || ''}
element={<SettingsEmail />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_SMTP]?.toString() || ""}
element={<SettingsEmail />}
/>
<PageRoute
path={
RouteMap[PageMap.SETTINGS_CALL_AND_SMS]?.toString() ||
''
}
element={<SettingsCallSMS />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_CALL_AND_SMS]?.toString() || ""}
element={<SettingsCallSMS />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_PROBES]?.toString() || ''}
element={<SettingsProbes />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_PROBES]?.toString() || ""}
element={<SettingsProbes />}
/>
<PageRoute
path={
RouteMap[PageMap.SETTINGS_AUTHENTICATION]?.toString() ||
''
}
element={<SettingsAuthentication />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_AUTHENTICATION]?.toString() || ""}
element={<SettingsAuthentication />}
/>
<PageRoute
path={RouteMap[PageMap.SETTINGS_API_KEY]?.toString() || ''}
element={<SettingsAPIKey />}
/>
</Routes>
</MasterPage>
);
<PageRoute
path={RouteMap[PageMap.SETTINGS_API_KEY]?.toString() || ""}
element={<SettingsAPIKey />}
/>
</Routes>
</MasterPage>
);
};
export default App;

View File

@@ -1,122 +1,114 @@
import HTTPResponse from 'Common/Types/API/HTTPResponse';
import URL from 'Common/Types/API/URL';
import Dictionary from 'Common/Types/Dictionary';
import BadDataException from 'Common/Types/Exception/BadDataException';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import { JSONObject } from 'Common/Types/JSON';
import API from 'Common/Utils/API';
import Footer from 'CommonUI/src/Components/Footer/Footer';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
import { HOST, HTTP_PROTOCOL } from 'CommonUI/src/Config';
import React from 'react';
import HTTPResponse from "Common/Types/API/HTTPResponse";
import URL from "Common/Types/API/URL";
import Dictionary from "Common/Types/Dictionary";
import BadDataException from "Common/Types/Exception/BadDataException";
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import { JSONObject } from "Common/Types/JSON";
import API from "Common/Utils/API";
import Footer from "CommonUI/src/Components/Footer/Footer";
import ConfirmModal from "CommonUI/src/Components/Modal/ConfirmModal";
import { HOST, HTTP_PROTOCOL } from "CommonUI/src/Config";
import React from "react";
const DashboardFooter: () => JSX.Element = () => {
const [showAboutModal, setShowAboutModal] = React.useState<boolean>(false);
const [isAboutModalLoading, setIsAboutModalLoading] =
React.useState<boolean>(false);
const [versionText, setVersionText] = React.useState<Dictionary<string>>(
{}
const [showAboutModal, setShowAboutModal] = React.useState<boolean>(false);
const [isAboutModalLoading, setIsAboutModalLoading] =
React.useState<boolean>(false);
const [versionText, setVersionText] = React.useState<Dictionary<string>>({});
const fetchVersions: PromiseVoidFunction = async (): Promise<void> => {
setIsAboutModalLoading(true);
try {
const verText: Dictionary<string> = {};
const apps: Array<{
name: string;
path: string;
}> = [
{
name: "API",
path: "/api",
},
{
name: "Dashboard",
path: "/dashboard",
},
];
for (const app of apps) {
const version: JSONObject = await fetchAppVersion(app.path);
verText[app.name] =
`${app.name}: ${version["version"]} (${version["commit"]})`;
}
setVersionText(verText);
} catch (err) {
setVersionText({
error: "Version data is not available: " + (err as Error).message,
});
}
setIsAboutModalLoading(false);
};
const fetchAppVersion: (appName: string) => Promise<JSONObject> = async (
appName: string,
): Promise<JSONObject> => {
const response: HTTPResponse<JSONObject> = await API.get<JSONObject>(
URL.fromString(`${HTTP_PROTOCOL}/${HOST}${appName}/version`),
);
const fetchVersions: PromiseVoidFunction = async (): Promise<void> => {
setIsAboutModalLoading(true);
if (response.data) {
return response.data as JSONObject;
}
throw new BadDataException("Version data is not available");
};
try {
const verText: Dictionary<string> = {};
const apps: Array<{
name: string;
path: string;
}> = [
{
name: 'API',
path: '/api',
},
{
name: 'Dashboard',
path: '/dashboard',
},
];
return (
<>
<Footer
className="bg-white h-16 inset-x-0 bottom-0 px-8"
copyright="HackerBay, Inc."
links={[
{
title: "Help and Support",
to: URL.fromString("https://oneuptime.com/support"),
},
{
title: "Legal",
to: URL.fromString("https://oneuptime.com/legal"),
},
{
title: "Version",
onClick: async () => {
setShowAboutModal(true);
await fetchVersions();
},
},
]}
/>
for (const app of apps) {
const version: JSONObject = await fetchAppVersion(app.path);
verText[
app.name
] = `${app.name}: ${version['version']} (${version['commit']})`;
}
setVersionText(verText);
} catch (err) {
setVersionText({
error:
'Version data is not available: ' + (err as Error).message,
});
}
setIsAboutModalLoading(false);
};
const fetchAppVersion: (appName: string) => Promise<JSONObject> = async (
appName: string
): Promise<JSONObject> => {
const response: HTTPResponse<JSONObject> = await API.get<JSONObject>(
URL.fromString(`${HTTP_PROTOCOL}/${HOST}${appName}/version`)
);
if (response.data) {
return response.data as JSONObject;
}
throw new BadDataException('Version data is not available');
};
return (
<>
<Footer
className="bg-white h-16 inset-x-0 bottom-0 px-8"
copyright="HackerBay, Inc."
links={[
{
title: 'Help and Support',
to: URL.fromString('https://oneuptime.com/support'),
},
{
title: 'Legal',
to: URL.fromString('https://oneuptime.com/legal'),
},
{
title: 'Version',
onClick: async () => {
setShowAboutModal(true);
await fetchVersions();
},
},
]}
/>
{showAboutModal ? (
<ConfirmModal
title={`OneUptime Version`}
description={
<div>
{Object.keys(versionText).map(
(key: string, i: number) => {
return (
<div key={i}>{versionText[key]}</div>
);
}
)}
</div>
}
isLoading={isAboutModalLoading}
submitButtonText={'Close'}
onSubmit={() => {
return setShowAboutModal(false);
}}
/>
) : (
<></>
)}
</>
);
{showAboutModal ? (
<ConfirmModal
title={`OneUptime Version`}
description={
<div>
{Object.keys(versionText).map((key: string, i: number) => {
return <div key={i}>{versionText[key]}</div>;
})}
</div>
}
isLoading={isAboutModalLoading}
submitButtonText={"Close"}
onSubmit={() => {
return setShowAboutModal(false);
}}
/>
) : (
<></>
)}
</>
);
};
export default DashboardFooter;

View File

@@ -1,46 +1,46 @@
import Help from './Help';
import Logo from './Logo';
import UserProfile from './UserProfile';
import Button, { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
import Header from 'CommonUI/src/Components/Header/Header';
import { DASHBOARD_URL } from 'CommonUI/src/Config';
import Navigation from 'CommonUI/src/Utils/Navigation';
import React, { FunctionComponent, ReactElement } from 'react';
import Help from "./Help";
import Logo from "./Logo";
import UserProfile from "./UserProfile";
import Button, { ButtonStyleType } from "CommonUI/src/Components/Button/Button";
import Header from "CommonUI/src/Components/Header/Header";
import { DASHBOARD_URL } from "CommonUI/src/Config";
import Navigation from "CommonUI/src/Utils/Navigation";
import React, { FunctionComponent, ReactElement } from "react";
const DashboardHeader: FunctionComponent = (): ReactElement => {
return (
<>
<Header
leftComponents={
<>
<Logo onClick={() => {}} />
</>
}
centerComponents={
<>
{/* <SearchBox
return (
<>
<Header
leftComponents={
<>
<Logo onClick={() => {}} />
</>
}
centerComponents={
<>
{/* <SearchBox
key={2}
selectedProject={props.selectedProject}
onChange={(_value: string) => { }}
/>{' '} */}
</>
}
rightComponents={
<>
<Button
title="Exit Admin"
buttonStyle={ButtonStyleType.NORMAL}
onClick={() => {
Navigation.navigate(DASHBOARD_URL);
}}
/>
<Help />
<UserProfile />
</>
}
</>
}
rightComponents={
<>
<Button
title="Exit Admin"
buttonStyle={ButtonStyleType.NORMAL}
onClick={() => {
Navigation.navigate(DASHBOARD_URL);
}}
/>
</>
);
<Help />
<UserProfile />
</>
}
/>
</>
);
};
export default DashboardHeader;

View File

@@ -1,60 +1,58 @@
import URL from 'Common/Types/API/URL';
import IconProp from 'Common/Types/Icon/IconProp';
import HeaderIconDropdownButton from 'CommonUI/src/Components/Header/HeaderIconDropdownButton';
import IconDropdownItem from 'CommonUI/src/Components/Header/IconDropdown/IconDropdownItem';
import IconDropdownMenu from 'CommonUI/src/Components/Header/IconDropdown/IconDropdownMenu';
import IconDropdownRow from 'CommonUI/src/Components/Header/IconDropdown/IconDropdownRow';
import React, { ReactElement, useState } from 'react';
import URL from "Common/Types/API/URL";
import IconProp from "Common/Types/Icon/IconProp";
import HeaderIconDropdownButton from "CommonUI/src/Components/Header/HeaderIconDropdownButton";
import IconDropdownItem from "CommonUI/src/Components/Header/IconDropdown/IconDropdownItem";
import IconDropdownMenu from "CommonUI/src/Components/Header/IconDropdown/IconDropdownMenu";
import IconDropdownRow from "CommonUI/src/Components/Header/IconDropdown/IconDropdownRow";
import React, { ReactElement, useState } from "react";
const Help: () => JSX.Element = (): ReactElement => {
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
return (
<HeaderIconDropdownButton
icon={IconProp.Help}
name="Help"
showDropdown={isDropdownVisible}
return (
<HeaderIconDropdownButton
icon={IconProp.Help}
name="Help"
showDropdown={isDropdownVisible}
onClick={() => {
setIsDropdownVisible(true);
}}
>
<IconDropdownMenu>
<IconDropdownRow>
<IconDropdownItem
title="Support Email"
icon={IconProp.Email}
openInNewTab={true}
url={URL.fromString("mailto:support@oneuptime.com")}
onClick={() => {
setIsDropdownVisible(true);
setIsDropdownVisible(false);
}}
>
<IconDropdownMenu>
<IconDropdownRow>
<IconDropdownItem
title="Support Email"
icon={IconProp.Email}
openInNewTab={true}
url={URL.fromString('mailto:support@oneuptime.com')}
onClick={() => {
setIsDropdownVisible(false);
}}
/>
<IconDropdownItem
title="Chat on Slack"
icon={IconProp.Slack}
openInNewTab={true}
onClick={() => {
setIsDropdownVisible(false);
}}
url={URL.fromString(
'https://join.slack.com/t/oneuptimesupport/shared_invite/zt-1kavkds2f-gegm_wePorvwvM3M_SaoCQ'
)}
/>
<IconDropdownItem
title="Request Demo"
icon={IconProp.Window}
onClick={() => {
setIsDropdownVisible(false);
}}
openInNewTab={true}
url={URL.fromString(
'https://oneuptime.com/enterprise/demo'
)}
/>
</IconDropdownRow>
</IconDropdownMenu>
</HeaderIconDropdownButton>
);
/>
<IconDropdownItem
title="Chat on Slack"
icon={IconProp.Slack}
openInNewTab={true}
onClick={() => {
setIsDropdownVisible(false);
}}
url={URL.fromString(
"https://join.slack.com/t/oneuptimesupport/shared_invite/zt-1kavkds2f-gegm_wePorvwvM3M_SaoCQ",
)}
/>
<IconDropdownItem
title="Request Demo"
icon={IconProp.Window}
onClick={() => {
setIsDropdownVisible(false);
}}
openInNewTab={true}
url={URL.fromString("https://oneuptime.com/enterprise/demo")}
/>
</IconDropdownRow>
</IconDropdownMenu>
</HeaderIconDropdownButton>
);
};
export default Help;

View File

@@ -1,30 +1,30 @@
// Tailwind
import Route from 'Common/Types/API/Route';
import Image from 'CommonUI/src/Components/Image/Image';
import OneUptimeLogo from 'CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg';
import React, { FunctionComponent, ReactElement } from 'react';
import Route from "Common/Types/API/Route";
import Image from "CommonUI/src/Components/Image/Image";
import OneUptimeLogo from "CommonUI/src/Images/logos/OneUptimeSVG/3-transparent.svg";
import React, { FunctionComponent, ReactElement } from "react";
export interface ComponentProps {
onClick: () => void;
onClick: () => void;
}
const Logo: FunctionComponent<ComponentProps> = (
props: ComponentProps
props: ComponentProps,
): ReactElement => {
return (
<div className="relative z-10 flex px-2 lg:px-0">
<div className="flex flex-shrink-0 items-center">
<Image
className="block h-8 w-auto"
onClick={() => {
props.onClick && props.onClick();
}}
imageUrl={Route.fromString(`${OneUptimeLogo}`)}
alt={'OneUptime'}
/>
</div>
</div>
);
return (
<div className="relative z-10 flex px-2 lg:px-0">
<div className="flex flex-shrink-0 items-center">
<Image
className="block h-8 w-auto"
onClick={() => {
props.onClick && props.onClick();
}}
imageUrl={Route.fromString(`${OneUptimeLogo}`)}
alt={"OneUptime"}
/>
</div>
</div>
);
};
export default Logo;

View File

@@ -1,35 +1,35 @@
import IconProp from 'Common/Types/Icon/IconProp';
import HeaderIconDropdownButton from 'CommonUI/src/Components/Header/HeaderIconDropdownButton';
import NotificationItem from 'CommonUI/src/Components/Header/Notifications/NotificationItem';
import Notifications from 'CommonUI/src/Components/Header/Notifications/Notifications';
import React, { ReactElement, useState } from 'react';
import IconProp from "Common/Types/Icon/IconProp";
import HeaderIconDropdownButton from "CommonUI/src/Components/Header/HeaderIconDropdownButton";
import NotificationItem from "CommonUI/src/Components/Header/Notifications/NotificationItem";
import Notifications from "CommonUI/src/Components/Header/Notifications/Notifications";
import React, { ReactElement, useState } from "react";
const DashboardHeader: () => JSX.Element = (): ReactElement => {
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
return (
<HeaderIconDropdownButton
name="Notifications"
onClick={() => {
setIsDropdownVisible(true);
}}
showDropdown={isDropdownVisible}
icon={IconProp.Notification}
badge={4}
>
<Notifications>
<NotificationItem
title="Sample Title"
description="Sample Description"
createdAt={new Date()}
icon={IconProp.Home}
onClick={() => {
setIsDropdownVisible(false);
}}
/>
</Notifications>
</HeaderIconDropdownButton>
);
return (
<HeaderIconDropdownButton
name="Notifications"
onClick={() => {
setIsDropdownVisible(true);
}}
showDropdown={isDropdownVisible}
icon={IconProp.Notification}
badge={4}
>
<Notifications>
<NotificationItem
title="Sample Title"
description="Sample Description"
createdAt={new Date()}
icon={IconProp.Home}
onClick={() => {
setIsDropdownVisible(false);
}}
/>
</Notifications>
</HeaderIconDropdownButton>
);
};
export default DashboardHeader;

View File

@@ -1,286 +1,273 @@
import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
import IconProp from 'Common/Types/Icon/IconProp';
import { FormType } from 'CommonUI/src/Components/Forms/ModelForm';
import Field from 'CommonUI/src/Components/Forms/Types/Field';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import ProjectPicker from 'CommonUI/src/Components/Header/ProjectPicker/ProjectPicker';
import ModelFormModal from 'CommonUI/src/Components/ModelFormModal/ModelFormModal';
import { RadioButton } from 'CommonUI/src/Components/RadioButtons/GroupRadioButtons';
import Toggle from 'CommonUI/src/Components/Toggle/Toggle';
import { BILLING_ENABLED, getAllEnvVars } from 'CommonUI/src/Config';
import { GetReactElementFunction } from 'CommonUI/src/Types/FunctionTypes';
import ProjectUtil from 'CommonUI/src/Utils/Project';
import Project from 'Model/Models/Project';
import SubscriptionPlan from "Common/Types/Billing/SubscriptionPlan";
import IconProp from "Common/Types/Icon/IconProp";
import { FormType } from "CommonUI/src/Components/Forms/ModelForm";
import Field from "CommonUI/src/Components/Forms/Types/Field";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import ProjectPicker from "CommonUI/src/Components/Header/ProjectPicker/ProjectPicker";
import ModelFormModal from "CommonUI/src/Components/ModelFormModal/ModelFormModal";
import { RadioButton } from "CommonUI/src/Components/RadioButtons/GroupRadioButtons";
import Toggle from "CommonUI/src/Components/Toggle/Toggle";
import { BILLING_ENABLED, getAllEnvVars } from "CommonUI/src/Config";
import { GetReactElementFunction } from "CommonUI/src/Types/FunctionTypes";
import ProjectUtil from "CommonUI/src/Utils/Project";
import Project from "Model/Models/Project";
import React, {
FunctionComponent,
ReactElement,
useEffect,
useState,
} from 'react';
FunctionComponent,
ReactElement,
useEffect,
useState,
} from "react";
export interface ComponentProps {
projects: Array<Project>;
onProjectSelected: (project: Project) => void;
showProjectModal: boolean;
onProjectModalClose: () => void;
projects: Array<Project>;
onProjectSelected: (project: Project) => void;
showProjectModal: boolean;
onProjectModalClose: () => void;
}
const DashboardProjectPicker: FunctionComponent<ComponentProps> = (
props: ComponentProps
props: ComponentProps,
): ReactElement => {
const [showModal, setShowModal] = useState<boolean>(false);
const [selectedProject, setSelectedProject] = useState<Project | null>(
null
);
const [showModal, setShowModal] = useState<boolean>(false);
const [selectedProject, setSelectedProject] = useState<Project | null>(null);
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}
return (
<Toggle
title="Yearly Plan"
value={isSubscriptionPlanYearly}
description="(Save 20%)"
onChange={(value: boolean) => {
setIsSubscriptionPlanYearly(value);
}}
/>
);
};
const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] =
useState<boolean>(true);
const [fields, setFields] = useState<Array<Field<Project>>>([]);
useEffect(() => {
if (props.showProjectModal) {
setShowModal(true);
}
}, [props.showProjectModal]);
useEffect(() => {
const currentProject: Project | null = ProjectUtil.getCurrentProject();
setSelectedProject(currentProject);
if (currentProject && props.onProjectSelected) {
props.onProjectSelected(currentProject);
}
}, []);
useEffect(() => {
if (selectedProject) {
ProjectUtil.setCurrentProject(selectedProject);
if (props.onProjectSelected) {
props.onProjectSelected(selectedProject);
}
}
}, [selectedProject]);
useEffect(() => {
if (
props.projects &&
props.projects.length > 0 &&
!selectedProject &&
props.projects[0]
) {
const currentProject: Project | null =
ProjectUtil.getCurrentProject();
if (!currentProject) {
setSelectedProject(props.projects[0]);
} else if (
props.projects.filter((project: Project) => {
return project._id === currentProject._id;
}).length > 0
) {
setSelectedProject(
props.projects.filter((project: Project) => {
return project._id === currentProject._id;
})[0] as Project
);
} else {
setSelectedProject(props.projects[0]);
}
}
}, [props.projects]);
useEffect(() => {
refreshFields();
}, [isSubscriptionPlanYearly]);
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {
name: true,
},
validation: {
minLength: 4,
},
fieldType: FormFieldSchemaType.Text,
placeholder: 'My Project',
description: 'Pick a friendly name.',
title: 'Project Name',
required: true,
stepId: BILLING_ENABLED ? 'basic' : undefined,
},
];
if (BILLING_ENABLED) {
formFields = [
...formFields,
{
field: {
paymentProviderPlanId: true,
},
stepId: 'plan',
validation: {
minLength: 6,
},
footerElement: getFooter(),
fieldType: FormFieldSchemaType.RadioButton,
radioButtonOptions: SubscriptionPlan.getSubscriptionPlans(
getAllEnvVars()
).map((plan: SubscriptionPlan): RadioButton => {
let description: string = plan.isCustomPricing()
? `Our sales team will contact you soon.`
: `Billed ${
isSubscriptionPlanYearly
? 'yearly'
: 'monthly'
}. ${
plan.getTrialPeriod() > 0
? `Free ${plan.getTrialPeriod()} days trial.`
: ''
}`;
if (
isSubscriptionPlanYearly &&
plan.getYearlySubscriptionAmountInUSD() === 0
) {
description = 'This plan is free, forever. ';
}
if (
!isSubscriptionPlanYearly &&
plan.getMonthlySubscriptionAmountInUSD() === 0
) {
description = 'This plan is free, forever. ';
}
return {
value: isSubscriptionPlanYearly
? plan.getYearlyPlanId()
: plan.getMonthlyPlanId(),
title: plan.getName(),
description: description,
sideTitle: plan.isCustomPricing()
? 'Custom Price'
: isSubscriptionPlanYearly
? '$' +
plan
.getYearlySubscriptionAmountInUSD()
.toString() +
'/mo billed yearly'
: '$' +
plan
.getMonthlySubscriptionAmountInUSD()
.toString(),
sideDescription: plan.isCustomPricing()
? ''
: isSubscriptionPlanYearly
? `~ $${
plan.getYearlySubscriptionAmountInUSD() *
12
} per user / year`
: `/month per user`,
};
}),
title: 'Please select a plan.',
required: true,
},
{
field: {
paymentProviderPromoCode: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: 'Promo Code (Optional)',
description: 'If you have a coupon code, enter it here.',
title: 'Promo Code',
required: false,
stepId: 'plan',
},
];
}
setFields(formFields);
};
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}
return (
<>
{props.projects.length !== 0 && (
<ProjectPicker
selectedProjectName={selectedProject?.name || ''}
selectedProjectIcon={IconProp.Folder}
projects={props.projects}
onCreateProjectButtonClicked={() => {
setShowModal(true);
props.onProjectModalClose();
}}
onProjectSelected={(project: Project) => {
setSelectedProject(project);
}}
/>
)}
{showModal ? (
<ModelFormModal<Project>
modelType={Project}
name="Create New Project"
title="Create New Project"
description="Please create a new OneUptime project to get started."
onClose={() => {
setShowModal(false);
props.onProjectModalClose();
}}
submitButtonText="Create Project"
onSuccess={(project: Project | null) => {
setSelectedProject(project);
if (project && props.onProjectSelected) {
props.onProjectSelected(project);
}
setShowModal(false);
props.onProjectModalClose();
}}
formProps={{
name: 'Create New Project',
steps: BILLING_ENABLED
? [
{
title: 'Basic',
id: 'basic',
},
{
title: 'Select Plan',
id: 'plan',
},
]
: undefined,
saveRequestOptions: {
isMultiTenantRequest: true, // because this is a tenant request, we do not have to include the header in the request
},
modelType: Project,
id: 'create-project-from',
fields: [...fields],
formType: FormType.Create,
}}
/>
) : (
<></>
)}
</>
<Toggle
title="Yearly Plan"
value={isSubscriptionPlanYearly}
description="(Save 20%)"
onChange={(value: boolean) => {
setIsSubscriptionPlanYearly(value);
}}
/>
);
};
const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] =
useState<boolean>(true);
const [fields, setFields] = useState<Array<Field<Project>>>([]);
useEffect(() => {
if (props.showProjectModal) {
setShowModal(true);
}
}, [props.showProjectModal]);
useEffect(() => {
const currentProject: Project | null = ProjectUtil.getCurrentProject();
setSelectedProject(currentProject);
if (currentProject && props.onProjectSelected) {
props.onProjectSelected(currentProject);
}
}, []);
useEffect(() => {
if (selectedProject) {
ProjectUtil.setCurrentProject(selectedProject);
if (props.onProjectSelected) {
props.onProjectSelected(selectedProject);
}
}
}, [selectedProject]);
useEffect(() => {
if (
props.projects &&
props.projects.length > 0 &&
!selectedProject &&
props.projects[0]
) {
const currentProject: Project | null = ProjectUtil.getCurrentProject();
if (!currentProject) {
setSelectedProject(props.projects[0]);
} else if (
props.projects.filter((project: Project) => {
return project._id === currentProject._id;
}).length > 0
) {
setSelectedProject(
props.projects.filter((project: Project) => {
return project._id === currentProject._id;
})[0] as Project,
);
} else {
setSelectedProject(props.projects[0]);
}
}
}, [props.projects]);
useEffect(() => {
refreshFields();
}, [isSubscriptionPlanYearly]);
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {
name: true,
},
validation: {
minLength: 4,
},
fieldType: FormFieldSchemaType.Text,
placeholder: "My Project",
description: "Pick a friendly name.",
title: "Project Name",
required: true,
stepId: BILLING_ENABLED ? "basic" : undefined,
},
];
if (BILLING_ENABLED) {
formFields = [
...formFields,
{
field: {
paymentProviderPlanId: true,
},
stepId: "plan",
validation: {
minLength: 6,
},
footerElement: getFooter(),
fieldType: FormFieldSchemaType.RadioButton,
radioButtonOptions: SubscriptionPlan.getSubscriptionPlans(
getAllEnvVars(),
).map((plan: SubscriptionPlan): RadioButton => {
let description: string = plan.isCustomPricing()
? `Our sales team will contact you soon.`
: `Billed ${isSubscriptionPlanYearly ? "yearly" : "monthly"}. ${
plan.getTrialPeriod() > 0
? `Free ${plan.getTrialPeriod()} days trial.`
: ""
}`;
if (
isSubscriptionPlanYearly &&
plan.getYearlySubscriptionAmountInUSD() === 0
) {
description = "This plan is free, forever. ";
}
if (
!isSubscriptionPlanYearly &&
plan.getMonthlySubscriptionAmountInUSD() === 0
) {
description = "This plan is free, forever. ";
}
return {
value: isSubscriptionPlanYearly
? plan.getYearlyPlanId()
: plan.getMonthlyPlanId(),
title: plan.getName(),
description: description,
sideTitle: plan.isCustomPricing()
? "Custom Price"
: isSubscriptionPlanYearly
? "$" +
plan.getYearlySubscriptionAmountInUSD().toString() +
"/mo billed yearly"
: "$" + plan.getMonthlySubscriptionAmountInUSD().toString(),
sideDescription: plan.isCustomPricing()
? ""
: isSubscriptionPlanYearly
? `~ $${
plan.getYearlySubscriptionAmountInUSD() * 12
} per user / year`
: `/month per user`,
};
}),
title: "Please select a plan.",
required: true,
},
{
field: {
paymentProviderPromoCode: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: "Promo Code (Optional)",
description: "If you have a coupon code, enter it here.",
title: "Promo Code",
required: false,
stepId: "plan",
},
];
}
setFields(formFields);
};
return (
<>
{props.projects.length !== 0 && (
<ProjectPicker
selectedProjectName={selectedProject?.name || ""}
selectedProjectIcon={IconProp.Folder}
projects={props.projects}
onCreateProjectButtonClicked={() => {
setShowModal(true);
props.onProjectModalClose();
}}
onProjectSelected={(project: Project) => {
setSelectedProject(project);
}}
/>
)}
{showModal ? (
<ModelFormModal<Project>
modelType={Project}
name="Create New Project"
title="Create New Project"
description="Please create a new OneUptime project to get started."
onClose={() => {
setShowModal(false);
props.onProjectModalClose();
}}
submitButtonText="Create Project"
onSuccess={(project: Project | null) => {
setSelectedProject(project);
if (project && props.onProjectSelected) {
props.onProjectSelected(project);
}
setShowModal(false);
props.onProjectModalClose();
}}
formProps={{
name: "Create New Project",
steps: BILLING_ENABLED
? [
{
title: "Basic",
id: "basic",
},
{
title: "Select Plan",
id: "plan",
},
]
: undefined,
saveRequestOptions: {
isMultiTenantRequest: true, // because this is a tenant request, we do not have to include the header in the request
},
modelType: Project,
id: "create-project-from",
fields: [...fields],
formType: FormType.Create,
}}
/>
) : (
<></>
)}
</>
);
};
export default DashboardProjectPicker;

View File

@@ -1,20 +1,20 @@
import SearchBox from 'CommonUI/src/Components/Header/SearchBox';
import Project from 'Model/Models/Project';
import React, { FunctionComponent, ReactElement } from 'react';
import SearchBox from "CommonUI/src/Components/Header/SearchBox";
import Project from "Model/Models/Project";
import React, { FunctionComponent, ReactElement } from "react";
export interface ComponentProps {
onChange: (search: string) => void;
selectedProject: Project | null;
onChange: (search: string) => void;
selectedProject: Project | null;
}
const Search: FunctionComponent<ComponentProps> = (
props: ComponentProps
props: ComponentProps,
): ReactElement => {
if (!props.selectedProject) {
return <></>;
}
if (!props.selectedProject) {
return <></>;
}
return <SearchBox key={2} onChange={props.onChange} />;
return <SearchBox key={2} onChange={props.onChange} />;
};
export default Search;

View File

@@ -1,57 +1,57 @@
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import Route from 'Common/Types/API/Route';
import IconProp from 'Common/Types/Icon/IconProp';
import HeaderIconDropdownButton from 'CommonUI/src/Components/Header/HeaderIconDropdownButton';
import IconDropdownItem from 'CommonUI/src/Components/Header/IconDropdown/IconDropdownItem';
import IconDropdownMenu from 'CommonUI/src/Components/Header/IconDropdown/IconDropdownMenu';
import { DASHBOARD_URL } from 'CommonUI/src/Config';
import BlankProfilePic from 'CommonUI/src/Images/users/blank-profile.svg';
import Navigation from 'CommonUI/src/Utils/Navigation';
import User from 'CommonUI/src/Utils/User';
import React, { FunctionComponent, ReactElement, useState } from 'react';
import PageMap from "../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
import Route from "Common/Types/API/Route";
import IconProp from "Common/Types/Icon/IconProp";
import HeaderIconDropdownButton from "CommonUI/src/Components/Header/HeaderIconDropdownButton";
import IconDropdownItem from "CommonUI/src/Components/Header/IconDropdown/IconDropdownItem";
import IconDropdownMenu from "CommonUI/src/Components/Header/IconDropdown/IconDropdownMenu";
import { DASHBOARD_URL } from "CommonUI/src/Config";
import BlankProfilePic from "CommonUI/src/Images/users/blank-profile.svg";
import Navigation from "CommonUI/src/Utils/Navigation";
import User from "CommonUI/src/Utils/User";
import React, { FunctionComponent, ReactElement, useState } from "react";
const DashboardUserProfile: FunctionComponent = (): ReactElement => {
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
const [isDropdownVisible, setIsDropdownVisible] = useState<boolean>(false);
return (
<>
<HeaderIconDropdownButton
iconImageUrl={BlankProfilePic}
name="User Profile"
showDropdown={isDropdownVisible}
onClick={() => {
setIsDropdownVisible(true);
}}
>
<IconDropdownMenu>
{User.isMasterAdmin() ? (
<IconDropdownItem
title="Exit Admin"
onClick={() => {
setIsDropdownVisible(false);
Navigation.navigate(DASHBOARD_URL);
}}
icon={IconProp.ExternalLink}
/>
) : (
<></>
)}
return (
<>
<HeaderIconDropdownButton
iconImageUrl={BlankProfilePic}
name="User Profile"
showDropdown={isDropdownVisible}
onClick={() => {
setIsDropdownVisible(true);
}}
>
<IconDropdownMenu>
{User.isMasterAdmin() ? (
<IconDropdownItem
title="Exit Admin"
onClick={() => {
setIsDropdownVisible(false);
Navigation.navigate(DASHBOARD_URL);
}}
icon={IconProp.ExternalLink}
/>
) : (
<></>
)}
<IconDropdownItem
title="Log out"
onClick={() => {
setIsDropdownVisible(false);
}}
url={RouteUtil.populateRouteParams(
RouteMap[PageMap.LOGOUT] as Route
)}
icon={IconProp.Logout}
/>
</IconDropdownMenu>
</HeaderIconDropdownButton>
</>
);
<IconDropdownItem
title="Log out"
onClick={() => {
setIsDropdownVisible(false);
}}
url={RouteUtil.populateRouteParams(
RouteMap[PageMap.LOGOUT] as Route,
)}
icon={IconProp.Logout}
/>
</IconDropdownMenu>
</HeaderIconDropdownButton>
</>
);
};
export default DashboardUserProfile;

View File

@@ -1,35 +1,35 @@
import Footer from '../Footer/Footer';
import Header from '../Header/Header';
import NavBar from '../NavBar/NavBar';
import MasterPage from 'CommonUI/src/Components/MasterPage/MasterPage';
import TopAlert from 'CommonUI/src/Components/TopAlert/TopAlert';
import React, { FunctionComponent, ReactElement } from 'react';
import Footer from "../Footer/Footer";
import Header from "../Header/Header";
import NavBar from "../NavBar/NavBar";
import MasterPage from "CommonUI/src/Components/MasterPage/MasterPage";
import TopAlert from "CommonUI/src/Components/TopAlert/TopAlert";
import React, { FunctionComponent, ReactElement } from "react";
export interface ComponentProps {
children: ReactElement | Array<ReactElement>;
children: ReactElement | Array<ReactElement>;
}
const DashboardMasterPage: FunctionComponent<ComponentProps> = (
props: ComponentProps
props: ComponentProps,
): ReactElement => {
return (
<div>
<TopAlert
title="OneUptime Admin Dashboard"
description="You can perform your OneUptime server related tasks on this dashboard."
/>
<MasterPage
footer={<Footer />}
header={<Header />}
navBar={<NavBar />}
isLoading={false}
error={''}
className="flex flex-col h-screen justify-between"
>
{props.children}
</MasterPage>
</div>
);
return (
<div>
<TopAlert
title="OneUptime Admin Dashboard"
description="You can perform your OneUptime server related tasks on this dashboard."
/>
<MasterPage
footer={<Footer />}
header={<Header />}
navBar={<NavBar />}
isLoading={false}
error={""}
className="flex flex-col h-screen justify-between"
>
{props.children}
</MasterPage>
</div>
);
};
export default DashboardMasterPage;

View File

@@ -1,39 +1,37 @@
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import Route from 'Common/Types/API/Route';
import IconProp from 'Common/Types/Icon/IconProp';
import NavBar from 'CommonUI/src/Components/Navbar/NavBar';
import NavBarItem from 'CommonUI/src/Components/Navbar/NavBarItem';
import React, { FunctionComponent, ReactElement } from 'react';
import PageMap from "../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
import Route from "Common/Types/API/Route";
import IconProp from "Common/Types/Icon/IconProp";
import NavBar from "CommonUI/src/Components/Navbar/NavBar";
import NavBarItem from "CommonUI/src/Components/Navbar/NavBarItem";
import React, { FunctionComponent, ReactElement } from "react";
const DashboardNavbar: FunctionComponent = (): ReactElement => {
return (
<NavBar>
<NavBarItem
title="Users"
icon={IconProp.User}
route={RouteUtil.populateRouteParams(
RouteMap[PageMap.USERS] as Route
)}
></NavBarItem>
return (
<NavBar>
<NavBarItem
title="Users"
icon={IconProp.User}
route={RouteUtil.populateRouteParams(RouteMap[PageMap.USERS] as Route)}
></NavBarItem>
<NavBarItem
title="Projects"
icon={IconProp.Folder}
route={RouteUtil.populateRouteParams(
RouteMap[PageMap.PROJECTS] as Route
)}
></NavBarItem>
<NavBarItem
title="Projects"
icon={IconProp.Folder}
route={RouteUtil.populateRouteParams(
RouteMap[PageMap.PROJECTS] as Route,
)}
></NavBarItem>
<NavBarItem
title="Settings"
icon={IconProp.Settings}
route={RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route
)}
></NavBarItem>
</NavBar>
);
<NavBarItem
title="Settings"
icon={IconProp.Settings}
route={RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route,
)}
></NavBarItem>
</NavBar>
);
};
export default DashboardNavbar;

View File

@@ -1,19 +1,19 @@
import App from './App';
import Telemetry from 'CommonUI/src/Utils/Telemetry';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import App from "./App";
import Telemetry from "CommonUI/src/Utils/Telemetry";
import React from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter } from "react-router-dom";
Telemetry.init({
serviceName: 'AdminDashboard',
serviceName: "AdminDashboard",
});
const root: any = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement
document.getElementById("root") as HTMLElement,
);
root.render(
<BrowserRouter>
<App />
</BrowserRouter>
<BrowserRouter>
<App />
</BrowserRouter>,
);

View File

@@ -1,22 +1,22 @@
import PageMap from '../../Utils/PageMap';
import RouteMap from '../../Utils/RouteMap';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import Page from 'CommonUI/src/Components/Page/Page';
import Navigation from 'CommonUI/src/Utils/Navigation';
import React, { FunctionComponent, ReactElement, useEffect } from 'react';
import PageMap from "../../Utils/PageMap";
import RouteMap from "../../Utils/RouteMap";
import PageLoader from "CommonUI/src/Components/Loader/PageLoader";
import Page from "CommonUI/src/Components/Page/Page";
import Navigation from "CommonUI/src/Utils/Navigation";
import React, { FunctionComponent, ReactElement, useEffect } from "react";
const Init: FunctionComponent = (): ReactElement => {
useEffect(() => {
Navigation.navigate(RouteMap[PageMap.USERS]!, {
forceNavigate: true,
});
}, []);
useEffect(() => {
Navigation.navigate(RouteMap[PageMap.USERS]!, {
forceNavigate: true,
});
}, []);
return (
<Page title={''} breadcrumbLinks={[]}>
<PageLoader isVisible={true} />
</Page>
);
return (
<Page title={""} breadcrumbLinks={[]}>
<PageLoader isVisible={true} />
</Page>
);
};
export default Init;

View File

@@ -1,53 +1,49 @@
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import Route from 'Common/Types/API/Route';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import Page from 'CommonUI/src/Components/Page/Page';
import { ACCOUNTS_URL } from 'CommonUI/src/Config';
import UiAnalytics from 'CommonUI/src/Utils/Analytics';
import Navigation from 'CommonUI/src/Utils/Navigation';
import UserUtil from 'CommonUI/src/Utils/User';
import React, { FunctionComponent, ReactElement, useEffect } from 'react';
import PageMap from "../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
import Route from "Common/Types/API/Route";
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import ErrorMessage from "CommonUI/src/Components/ErrorMessage/ErrorMessage";
import PageLoader from "CommonUI/src/Components/Loader/PageLoader";
import Page from "CommonUI/src/Components/Page/Page";
import { ACCOUNTS_URL } from "CommonUI/src/Config";
import UiAnalytics from "CommonUI/src/Utils/Analytics";
import Navigation from "CommonUI/src/Utils/Navigation";
import UserUtil from "CommonUI/src/Utils/User";
import React, { FunctionComponent, ReactElement, useEffect } from "react";
const Logout: FunctionComponent = (): ReactElement => {
const [error, setError] = React.useState<string | null>(null);
const [error, setError] = React.useState<string | null>(null);
const logout: PromiseVoidFunction = async (): Promise<void> => {
UiAnalytics.logout();
await UserUtil.logout();
Navigation.navigate(ACCOUNTS_URL);
};
const logout: PromiseVoidFunction = async (): Promise<void> => {
UiAnalytics.logout();
await UserUtil.logout();
Navigation.navigate(ACCOUNTS_URL);
};
useEffect(() => {
logout().catch((error: Error) => {
setError(error.message || error.toString());
});
}, []);
useEffect(() => {
logout().catch((error: Error) => {
setError(error.message || error.toString());
});
}, []);
return (
<Page
title={'Logout'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.INIT] as Route
),
},
{
title: 'Logout',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.LOGOUT] as Route
),
},
]}
>
{!error ? <PageLoader isVisible={true} /> : <></>}
{error ? <ErrorMessage error={error} /> : <></>}
</Page>
);
return (
<Page
title={"Logout"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.INIT] as Route),
},
{
title: "Logout",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.LOGOUT] as Route),
},
]}
>
{!error ? <PageLoader isVisible={true} /> : <></>}
{error ? <ErrorMessage error={error} /> : <></>}
</Page>
);
};
export default Logout;

View File

@@ -1,263 +1,251 @@
import AdminModelAPI from '../../Utils/ModelAPI';
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import Route from 'Common/Types/API/Route';
import SubscriptionPlan from 'Common/Types/Billing/SubscriptionPlan';
import Field from 'CommonUI/src/Components/Forms/Types/Field';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import Page from 'CommonUI/src/Components/Page/Page';
import { RadioButton } from 'CommonUI/src/Components/RadioButtons/GroupRadioButtons';
import Toggle from 'CommonUI/src/Components/Toggle/Toggle';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import { BILLING_ENABLED, getAllEnvVars } from 'CommonUI/src/Config';
import { GetReactElementFunction } from 'CommonUI/src/Types/FunctionTypes';
import Navigation from 'CommonUI/src/Utils/Navigation';
import Project from 'Model/Models/Project';
import User from 'Model/Models/User';
import AdminModelAPI from "../../Utils/ModelAPI";
import PageMap from "../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
import Route from "Common/Types/API/Route";
import SubscriptionPlan from "Common/Types/Billing/SubscriptionPlan";
import Field from "CommonUI/src/Components/Forms/Types/Field";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import ModelTable from "CommonUI/src/Components/ModelTable/ModelTable";
import Page from "CommonUI/src/Components/Page/Page";
import { RadioButton } from "CommonUI/src/Components/RadioButtons/GroupRadioButtons";
import Toggle from "CommonUI/src/Components/Toggle/Toggle";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import { BILLING_ENABLED, getAllEnvVars } from "CommonUI/src/Config";
import { GetReactElementFunction } from "CommonUI/src/Types/FunctionTypes";
import Navigation from "CommonUI/src/Utils/Navigation";
import Project from "Model/Models/Project";
import User from "Model/Models/User";
import React, {
FunctionComponent,
ReactElement,
useEffect,
useState,
} from 'react';
FunctionComponent,
ReactElement,
useEffect,
useState,
} from "react";
const Projects: FunctionComponent = (): ReactElement => {
const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] =
useState<boolean>(true);
const [isSubscriptionPlanYearly, setIsSubscriptionPlanYearly] =
useState<boolean>(true);
useEffect(() => {
refreshFields();
}, [isSubscriptionPlanYearly]);
useEffect(() => {
refreshFields();
}, [isSubscriptionPlanYearly]);
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {
name: true,
},
validation: {
minLength: 4,
},
fieldType: FormFieldSchemaType.Text,
placeholder: 'My Project',
description: 'Pick a friendly name.',
title: 'Project Name',
required: true,
stepId: BILLING_ENABLED ? 'basic' : undefined,
},
{
field: {
createdByUser: true,
},
title: 'Owner',
description:
'Who would you like the owner of this project to be? If you leave this blank - you will be the owner of the project',
fieldType: FormFieldSchemaType.Dropdown,
stepId: BILLING_ENABLED ? 'basic' : undefined,
dropdownModal: {
type: User,
labelField: 'email',
valueField: '_id',
},
},
];
const refreshFields: VoidFunction = (): void => {
let formFields: Array<Field<Project>> = [
{
field: {
name: true,
},
validation: {
minLength: 4,
},
fieldType: FormFieldSchemaType.Text,
placeholder: "My Project",
description: "Pick a friendly name.",
title: "Project Name",
required: true,
stepId: BILLING_ENABLED ? "basic" : undefined,
},
{
field: {
createdByUser: true,
},
title: "Owner",
description:
"Who would you like the owner of this project to be? If you leave this blank - you will be the owner of the project",
fieldType: FormFieldSchemaType.Dropdown,
stepId: BILLING_ENABLED ? "basic" : undefined,
dropdownModal: {
type: User,
labelField: "email",
valueField: "_id",
},
},
];
if (BILLING_ENABLED) {
formFields = [
...formFields,
{
field: {
paymentProviderPlanId: true,
},
stepId: 'plan',
validation: {
minLength: 6,
},
footerElement: getFooter(),
fieldType: FormFieldSchemaType.RadioButton,
radioButtonOptions: SubscriptionPlan.getSubscriptionPlans(
getAllEnvVars()
).map((plan: SubscriptionPlan): RadioButton => {
let description: string = plan.isCustomPricing()
? `Our sales team will contact you soon.`
: `Billed ${
isSubscriptionPlanYearly
? 'yearly'
: 'monthly'
}. ${
plan.getTrialPeriod() > 0
? `Free ${plan.getTrialPeriod()} days trial.`
: ''
}`;
if (BILLING_ENABLED) {
formFields = [
...formFields,
{
field: {
paymentProviderPlanId: true,
},
stepId: "plan",
validation: {
minLength: 6,
},
footerElement: getFooter(),
fieldType: FormFieldSchemaType.RadioButton,
radioButtonOptions: SubscriptionPlan.getSubscriptionPlans(
getAllEnvVars(),
).map((plan: SubscriptionPlan): RadioButton => {
let description: string = plan.isCustomPricing()
? `Our sales team will contact you soon.`
: `Billed ${isSubscriptionPlanYearly ? "yearly" : "monthly"}. ${
plan.getTrialPeriod() > 0
? `Free ${plan.getTrialPeriod()} days trial.`
: ""
}`;
if (
isSubscriptionPlanYearly &&
plan.getYearlySubscriptionAmountInUSD() === 0
) {
description = 'This plan is free, forever. ';
}
if (
isSubscriptionPlanYearly &&
plan.getYearlySubscriptionAmountInUSD() === 0
) {
description = "This plan is free, forever. ";
}
if (
!isSubscriptionPlanYearly &&
plan.getMonthlySubscriptionAmountInUSD() === 0
) {
description = 'This plan is free, forever. ';
}
if (
!isSubscriptionPlanYearly &&
plan.getMonthlySubscriptionAmountInUSD() === 0
) {
description = "This plan is free, forever. ";
}
return {
value: isSubscriptionPlanYearly
? plan.getYearlyPlanId()
: plan.getMonthlyPlanId(),
title: plan.getName(),
description: description,
sideTitle: plan.isCustomPricing()
? 'Custom Price'
: isSubscriptionPlanYearly
? '$' +
plan
.getYearlySubscriptionAmountInUSD()
.toString() +
'/mo billed yearly'
: '$' +
plan
.getMonthlySubscriptionAmountInUSD()
.toString(),
sideDescription: plan.isCustomPricing()
? ''
: isSubscriptionPlanYearly
? `~ $${
plan.getYearlySubscriptionAmountInUSD() *
12
} per user / year`
: `/month per user`,
};
}),
title: 'Please select a plan.',
required: true,
},
{
field: {
paymentProviderPromoCode: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: 'Promo Code (Optional)',
description: 'If you have a coupon code, enter it here.',
title: 'Promo Code',
required: false,
stepId: 'plan',
disabled: false,
},
];
}
return {
value: isSubscriptionPlanYearly
? plan.getYearlyPlanId()
: plan.getMonthlyPlanId(),
title: plan.getName(),
description: description,
sideTitle: plan.isCustomPricing()
? "Custom Price"
: isSubscriptionPlanYearly
? "$" +
plan.getYearlySubscriptionAmountInUSD().toString() +
"/mo billed yearly"
: "$" + plan.getMonthlySubscriptionAmountInUSD().toString(),
sideDescription: plan.isCustomPricing()
? ""
: isSubscriptionPlanYearly
? `~ $${
plan.getYearlySubscriptionAmountInUSD() * 12
} per user / year`
: `/month per user`,
};
}),
title: "Please select a plan.",
required: true,
},
{
field: {
paymentProviderPromoCode: true,
},
fieldType: FormFieldSchemaType.Text,
placeholder: "Promo Code (Optional)",
description: "If you have a coupon code, enter it here.",
title: "Promo Code",
required: false,
stepId: "plan",
disabled: false,
},
];
}
setFields(formFields);
};
setFields(formFields);
};
const [fields, setFields] = useState<Array<Field<Project>>>([]);
const [fields, setFields] = useState<Array<Field<Project>>>([]);
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}
return (
<Toggle
title="Yearly Plan"
value={isSubscriptionPlanYearly}
description="(Save 20%)"
onChange={(value: boolean) => {
setIsSubscriptionPlanYearly(value);
}}
/>
);
};
const getFooter: GetReactElementFunction = (): ReactElement => {
if (!BILLING_ENABLED) {
return <></>;
}
return (
<Page
title={'Projects'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
},
{
title: 'Projects',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.PROJECTS] as Route
),
},
]}
>
<ModelTable<Project>
modelType={Project}
modelAPI={AdminModelAPI}
id="projects-table"
isDeleteable={false}
isEditable={false}
isCreateable={true}
name="Projects"
isViewable={false}
cardProps={{
title: 'Projects',
description: 'Here is a list of proejcts in OneUptime.',
}}
showViewIdButton={true}
formSteps={
BILLING_ENABLED
? [
{
title: 'Basic',
id: 'basic',
},
{
title: 'Select Plan',
id: 'plan',
},
]
: undefined
}
noItemsMessage={'No projects found.'}
formFields={fields}
showRefreshButton={true}
viewPageRoute={Navigation.getCurrentRoute()}
filters={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
},
{
field: {
createdAt: true,
},
title: 'Created At',
type: FieldType.DateTime,
},
]}
columns={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
},
{
field: {
createdAt: true,
},
title: 'Created At',
type: FieldType.DateTime,
},
]}
/>
</Page>
<Toggle
title="Yearly Plan"
value={isSubscriptionPlanYearly}
description="(Save 20%)"
onChange={(value: boolean) => {
setIsSubscriptionPlanYearly(value);
}}
/>
);
};
return (
<Page
title={"Projects"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Projects",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.PROJECTS] as Route,
),
},
]}
>
<ModelTable<Project>
modelType={Project}
modelAPI={AdminModelAPI}
id="projects-table"
isDeleteable={false}
isEditable={false}
isCreateable={true}
name="Projects"
isViewable={false}
cardProps={{
title: "Projects",
description: "Here is a list of proejcts in OneUptime.",
}}
showViewIdButton={true}
formSteps={
BILLING_ENABLED
? [
{
title: "Basic",
id: "basic",
},
{
title: "Select Plan",
id: "plan",
},
]
: undefined
}
noItemsMessage={"No projects found."}
formFields={fields}
showRefreshButton={true}
viewPageRoute={Navigation.getCurrentRoute()}
filters={[
{
field: {
name: true,
},
title: "Name",
type: FieldType.Text,
},
{
field: {
createdAt: true,
},
title: "Created At",
type: FieldType.DateTime,
},
]}
columns={[
{
field: {
name: true,
},
title: "Name",
type: FieldType.Text,
},
{
field: {
createdAt: true,
},
title: "Created At",
type: FieldType.DateTime,
},
]}
/>
</Page>
);
};
export default Projects;

View File

@@ -1,102 +1,100 @@
import PageMap from '../../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
import DashboardSideMenu from '../SideMenu';
import Route from 'Common/Types/API/Route';
import ObjectID from 'Common/Types/ObjectID';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail';
import Page from 'CommonUI/src/Components/Page/Page';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import GlobalConfig from 'Model/Models/GlobalConfig';
import React, { FunctionComponent, ReactElement } from 'react';
import PageMap from "../../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../../Utils/RouteMap";
import DashboardSideMenu from "../SideMenu";
import Route from "Common/Types/API/Route";
import ObjectID from "Common/Types/ObjectID";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import CardModelDetail from "CommonUI/src/Components/ModelDetail/CardModelDetail";
import Page from "CommonUI/src/Components/Page/Page";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import GlobalConfig from "Model/Models/GlobalConfig";
import React, { FunctionComponent, ReactElement } from "react";
const Settings: FunctionComponent = (): ReactElement => {
return (
<Page
title={'Admin Settings'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
},
{
title: 'Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route
),
},
{
title: 'API Key',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_HOST] as Route
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="API Key Settings"
cardProps={{
title: 'Master API Key Settings',
description:
'This API key has root access to all the resources in all the projects on OneUptime.',
}}
isEditable={true}
editButtonText="Edit API Key Settings"
formFields={[
{
field: {
masterApiKey: true,
},
title: 'Master API Key',
fieldType: FormFieldSchemaType.ObjectID,
required: false,
},
{
field: {
isMasterApiKeyEnabled: true,
},
title: 'Enabled',
fieldType: FormFieldSchemaType.Toggle,
required: false,
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
fields: [
{
field: {
masterApiKey: true,
},
title: 'Master API Key',
description:
'This API key has root access to all the resources in all the projects on OneUptime.',
fieldType: FieldType.HiddenText,
opts: {
isCopyable: true,
},
placeholder: 'API Key not generated yet.',
},
{
field: {
isMasterApiKeyEnabled: true,
},
title: 'Enabled',
description:
'Enable or disable the master API key. If disabled, all requests using this key will fail.',
fieldType: FieldType.Boolean,
placeholder: 'Not Enabled',
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
</Page>
);
return (
<Page
title={"Admin Settings"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Settings",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route,
),
},
{
title: "API Key",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_HOST] as Route,
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="API Key Settings"
cardProps={{
title: "Master API Key Settings",
description:
"This API key has root access to all the resources in all the projects on OneUptime.",
}}
isEditable={true}
editButtonText="Edit API Key Settings"
formFields={[
{
field: {
masterApiKey: true,
},
title: "Master API Key",
fieldType: FormFieldSchemaType.ObjectID,
required: false,
},
{
field: {
isMasterApiKeyEnabled: true,
},
title: "Enabled",
fieldType: FormFieldSchemaType.Toggle,
required: false,
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
fields: [
{
field: {
masterApiKey: true,
},
title: "Master API Key",
description:
"This API key has root access to all the resources in all the projects on OneUptime.",
fieldType: FieldType.HiddenText,
opts: {
isCopyable: true,
},
placeholder: "API Key not generated yet.",
},
{
field: {
isMasterApiKeyEnabled: true,
},
title: "Enabled",
description:
"Enable or disable the master API key. If disabled, all requests using this key will fail.",
fieldType: FieldType.Boolean,
placeholder: "Not Enabled",
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
</Page>
);
};
export default Settings;

View File

@@ -1,83 +1,80 @@
import PageMap from '../../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
import DashboardSideMenu from '../SideMenu';
import Route from 'Common/Types/API/Route';
import ObjectID from 'Common/Types/ObjectID';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail';
import Page from 'CommonUI/src/Components/Page/Page';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import GlobalConfig from 'Model/Models/GlobalConfig';
import React, { FunctionComponent, ReactElement } from 'react';
import PageMap from "../../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../../Utils/RouteMap";
import DashboardSideMenu from "../SideMenu";
import Route from "Common/Types/API/Route";
import ObjectID from "Common/Types/ObjectID";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import CardModelDetail from "CommonUI/src/Components/ModelDetail/CardModelDetail";
import Page from "CommonUI/src/Components/Page/Page";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import GlobalConfig from "Model/Models/GlobalConfig";
import React, { FunctionComponent, ReactElement } from "react";
const Settings: FunctionComponent = (): ReactElement => {
return (
<Page
title={'Admin Settings'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
},
{
title: 'Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route
),
},
{
title: 'Authentication',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_AUTHENTICATION] as Route
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="Authentication Settings"
cardProps={{
title: 'Authentication Settings',
description:
'Authentication Settings for this OneUptime Server instance.',
}}
isEditable={true}
editButtonText="Edit Settings"
formFields={[
{
field: {
disableSignup: true,
},
title: 'Disable Sign Up',
fieldType: FormFieldSchemaType.Toggle,
required: false,
description:
'Should we disable sign up of new users to OneUptime?',
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
fields: [
{
field: {
disableSignup: true,
},
fieldType: FieldType.Boolean,
title: 'Disable Sign Up',
placeholder: 'No',
description:
'Should we disable sign up of new users to OneUptime?',
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
</Page>
);
return (
<Page
title={"Admin Settings"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Settings",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route,
),
},
{
title: "Authentication",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_AUTHENTICATION] as Route,
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="Authentication Settings"
cardProps={{
title: "Authentication Settings",
description:
"Authentication Settings for this OneUptime Server instance.",
}}
isEditable={true}
editButtonText="Edit Settings"
formFields={[
{
field: {
disableSignup: true,
},
title: "Disable Sign Up",
fieldType: FormFieldSchemaType.Toggle,
required: false,
description: "Should we disable sign up of new users to OneUptime?",
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
fields: [
{
field: {
disableSignup: true,
},
fieldType: FieldType.Boolean,
title: "Disable Sign Up",
placeholder: "No",
description:
"Should we disable sign up of new users to OneUptime?",
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
</Page>
);
};
export default Settings;

View File

@@ -1,119 +1,114 @@
import PageMap from '../../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
import DashboardSideMenu from '../SideMenu';
import Route from 'Common/Types/API/Route';
import ObjectID from 'Common/Types/ObjectID';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail';
import Page from 'CommonUI/src/Components/Page/Page';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import GlobalConfig from 'Model/Models/GlobalConfig';
import React, { FunctionComponent, ReactElement } from 'react';
import PageMap from "../../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../../Utils/RouteMap";
import DashboardSideMenu from "../SideMenu";
import Route from "Common/Types/API/Route";
import ObjectID from "Common/Types/ObjectID";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import CardModelDetail from "CommonUI/src/Components/ModelDetail/CardModelDetail";
import Page from "CommonUI/src/Components/Page/Page";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import GlobalConfig from "Model/Models/GlobalConfig";
import React, { FunctionComponent, ReactElement } from "react";
const Settings: FunctionComponent = (): ReactElement => {
return (
<Page
title={'Admin Settings'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
},
{
title: 'Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route
),
},
{
title: 'Calls and SMS',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_CALL_AND_SMS] as Route
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="Call and SMS Settings"
cardProps={{
title: 'Twilio Config',
description: 'This will be used to make Call and send SMS.',
}}
isEditable={true}
editButtonText="Edit Twilio Config"
formFields={[
{
field: {
twilioAccountSID: true,
},
title: 'Twilio Account SID',
fieldType: FormFieldSchemaType.Text,
required: true,
description:
'You can find this in your Twilio console.',
placeholder: '',
validation: {
minLength: 2,
},
},
{
field: {
twilioAuthToken: true,
},
title: 'Twilio Auth Token',
fieldType: FormFieldSchemaType.Text,
required: true,
description:
'You can find this in your Twilio console.',
placeholder: '',
validation: {
minLength: 2,
},
},
{
field: {
twilioPhoneNumber: true,
},
title: 'Twilio Phone Number',
fieldType: FormFieldSchemaType.Phone,
required: true,
description:
'You can find this in your Twilio console.',
placeholder: '',
validation: {
minLength: 2,
},
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
fields: [
{
field: {
twilioAccountSID: true,
},
title: 'Twilio Account SID',
placeholder: 'None',
},
{
field: {
twilioPhoneNumber: true,
},
title: 'Twilio Phone Number',
fieldType: FieldType.Phone,
placeholder: 'None',
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
</Page>
);
return (
<Page
title={"Admin Settings"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Settings",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route,
),
},
{
title: "Calls and SMS",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_CALL_AND_SMS] as Route,
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="Call and SMS Settings"
cardProps={{
title: "Twilio Config",
description: "This will be used to make Call and send SMS.",
}}
isEditable={true}
editButtonText="Edit Twilio Config"
formFields={[
{
field: {
twilioAccountSID: true,
},
title: "Twilio Account SID",
fieldType: FormFieldSchemaType.Text,
required: true,
description: "You can find this in your Twilio console.",
placeholder: "",
validation: {
minLength: 2,
},
},
{
field: {
twilioAuthToken: true,
},
title: "Twilio Auth Token",
fieldType: FormFieldSchemaType.Text,
required: true,
description: "You can find this in your Twilio console.",
placeholder: "",
validation: {
minLength: 2,
},
},
{
field: {
twilioPhoneNumber: true,
},
title: "Twilio Phone Number",
fieldType: FormFieldSchemaType.Phone,
required: true,
description: "You can find this in your Twilio console.",
placeholder: "",
validation: {
minLength: 2,
},
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
fields: [
{
field: {
twilioAccountSID: true,
},
title: "Twilio Account SID",
placeholder: "None",
},
{
field: {
twilioPhoneNumber: true,
},
title: "Twilio Phone Number",
fieldType: FieldType.Phone,
placeholder: "None",
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
</Page>
);
};
export default Settings;

View File

@@ -1,427 +1,419 @@
import PageMap from '../../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
import DashboardSideMenu from '../SideMenu';
import Route from 'Common/Types/API/Route';
import { Green, Red } from 'Common/Types/BrandColors';
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
import ObjectID from 'Common/Types/ObjectID';
import ErrorMessage from 'CommonUI/src/Components/ErrorMessage/ErrorMessage';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import PageLoader from 'CommonUI/src/Components/Loader/PageLoader';
import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail';
import Page from 'CommonUI/src/Components/Page/Page';
import Pill from 'CommonUI/src/Components/Pill/Pill';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import GlobalConfig, { EmailServerType } from 'Model/Models/GlobalConfig';
import React, { FunctionComponent, ReactElement, useEffect } from 'react';
import PageMap from "../../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../../Utils/RouteMap";
import DashboardSideMenu from "../SideMenu";
import Route from "Common/Types/API/Route";
import { Green, Red } from "Common/Types/BrandColors";
import { PromiseVoidFunction } from "Common/Types/FunctionTypes";
import ObjectID from "Common/Types/ObjectID";
import ErrorMessage from "CommonUI/src/Components/ErrorMessage/ErrorMessage";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import PageLoader from "CommonUI/src/Components/Loader/PageLoader";
import CardModelDetail from "CommonUI/src/Components/ModelDetail/CardModelDetail";
import Page from "CommonUI/src/Components/Page/Page";
import Pill from "CommonUI/src/Components/Pill/Pill";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import DropdownUtil from "CommonUI/src/Utils/Dropdown";
import ModelAPI from "CommonUI/src/Utils/ModelAPI/ModelAPI";
import GlobalConfig, { EmailServerType } from "Model/Models/GlobalConfig";
import React, { FunctionComponent, ReactElement, useEffect } from "react";
const Settings: FunctionComponent = (): ReactElement => {
const [emailServerType, setemailServerType] =
React.useState<EmailServerType>(EmailServerType.Internal);
const [emailServerType, setemailServerType] = React.useState<EmailServerType>(
EmailServerType.Internal,
);
const [isLoading, setIsLoading] = React.useState<boolean>(true);
const [isLoading, setIsLoading] = React.useState<boolean>(true);
const [error, setError] = React.useState<string>('');
const [error, setError] = React.useState<string>("");
const fetchItem: PromiseVoidFunction = async (): Promise<void> => {
setIsLoading(true);
const fetchItem: PromiseVoidFunction = async (): Promise<void> => {
setIsLoading(true);
const globalConfig: GlobalConfig | null =
await ModelAPI.getItem<GlobalConfig>({
modelType: GlobalConfig,
id: ObjectID.getZeroObjectID(),
select: {
_id: true,
emailServerType: true,
},
});
const globalConfig: GlobalConfig | null =
await ModelAPI.getItem<GlobalConfig>({
modelType: GlobalConfig,
id: ObjectID.getZeroObjectID(),
select: {
_id: true,
emailServerType: true,
},
});
if (globalConfig) {
setemailServerType(
globalConfig.emailServerType || EmailServerType.Internal
);
}
setIsLoading(false);
};
useEffect(() => {
fetchItem().catch((err: Error) => {
setError(err.message);
});
}, []);
if (isLoading) {
return <PageLoader isVisible={true} />;
if (globalConfig) {
setemailServerType(
globalConfig.emailServerType || EmailServerType.Internal,
);
}
if (error) {
return <ErrorMessage error={error} />;
}
setIsLoading(false);
};
return (
<Page
title={'Admin Settings'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
useEffect(() => {
fetchItem().catch((err: Error) => {
setError(err.message);
});
}, []);
if (isLoading) {
return <PageLoader isVisible={true} />;
}
if (error) {
return <ErrorMessage error={error} />;
}
return (
<Page
title={"Admin Settings"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Settings",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route,
),
},
{
title: "Email Settings",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_SMTP] as Route,
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<CardModelDetail
name="Admin Notification Email"
cardProps={{
title: "Admin Notification Email",
description:
"Enter the email address where you would like to receive admin-level notifications.",
}}
isEditable={true}
editButtonText="Edit Email"
formFields={[
{
field: {
adminNotificationEmail: true,
},
title: "Admin Notification Email",
fieldType: FormFieldSchemaType.Email,
required: false,
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
fields: [
{
field: {
adminNotificationEmail: true,
},
title: "Admin Notification Email",
fieldType: FieldType.Email,
placeholder: "None",
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
<CardModelDetail
name="Internal SMTP Settings"
cardProps={{
title: "Email Server Settings",
description:
"Pick which email server you would like to use to send emails.",
}}
isEditable={true}
editButtonText="Edit Server"
onSaveSuccess={() => {
window.location.reload();
}}
formFields={[
{
field: {
emailServerType: true,
},
title: "Email Server Type",
fieldType: FormFieldSchemaType.Dropdown,
dropdownOptions:
DropdownUtil.getDropdownOptionsFromEnum(EmailServerType),
required: true,
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
fields: [
{
field: {
emailServerType: true,
},
title: "Email Server Type",
fieldType: FieldType.Text,
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
{emailServerType === EmailServerType.CustomSMTP ? (
<CardModelDetail
name="Host Settings"
cardProps={{
title: "Custom Email and SMTP Settings",
description:
"If you have not enabled Internal SMTP server to send emails. Please configure your SMTP server here.",
}}
isEditable={true}
editButtonText="Edit SMTP Config"
formSteps={[
{
title: "SMTP Server",
id: "server-info",
},
{
title: "Authentication",
id: "authentication",
},
{
title: "Email",
id: "email-info",
},
]}
formFields={[
{
field: {
smtpHost: true,
},
title: "Hostname",
stepId: "server-info",
fieldType: FormFieldSchemaType.Hostname,
required: true,
placeholder: "smtp.server.com",
},
{
field: {
smtpPort: true,
},
title: "Port",
stepId: "server-info",
fieldType: FormFieldSchemaType.Port,
required: true,
placeholder: "587",
},
{
field: {
isSMTPSecure: true,
},
title: "Use SSL / TLS",
stepId: "server-info",
fieldType: FormFieldSchemaType.Toggle,
description:
"If you use port 465, please enable this. Do not enable this if you use port 587.",
},
{
field: {
smtpUsername: true,
},
title: "Username",
stepId: "authentication",
fieldType: FormFieldSchemaType.Text,
required: false,
placeholder: "emailuser",
},
{
field: {
smtpPassword: true,
},
title: "Password",
stepId: "authentication",
fieldType: FormFieldSchemaType.EncryptedText,
required: false,
placeholder: "Password",
},
{
field: {
smtpFromEmail: true,
},
title: "Email From",
stepId: "email-info",
fieldType: FormFieldSchemaType.Email,
required: true,
description:
"This is the display email your team and customers see, when they receive emails from OneUptime.",
placeholder: "email@company.com",
},
{
field: {
smtpFromName: true,
},
title: "From Name",
stepId: "email-info",
fieldType: FormFieldSchemaType.Text,
required: true,
description:
"This is the display name your team and customers see, when they receive emails from OneUptime.",
placeholder: "Company, Inc.",
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
fields: [
{
field: {
smtpHost: true,
},
{
title: 'Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route
),
title: "SMTP Host",
placeholder: "None",
},
{
field: {
smtpPort: true,
},
{
title: 'Email Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_SMTP] as Route
),
title: "SMTP Port",
placeholder: "None",
},
{
field: {
smtpUsername: true,
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
title: "SMTP Username",
placeholder: "None",
},
{
field: {
smtpFromEmail: true,
},
title: "SMTP Email",
placeholder: "None",
fieldType: FieldType.Email,
},
{
field: {
smtpFromName: true,
},
title: "SMTP From Name",
placeholder: "None",
},
{
field: {
isSMTPSecure: true,
},
title: "Use SSL/TLS",
placeholder: "No",
fieldType: FieldType.Boolean,
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
) : (
<></>
)}
<CardModelDetail
name="Admin Notification Email"
cardProps={{
title: 'Admin Notification Email',
description:
'Enter the email address where you would like to receive admin-level notifications.',
}}
isEditable={true}
editButtonText="Edit Email"
formFields={[
{
field: {
adminNotificationEmail: true,
},
title: 'Admin Notification Email',
fieldType: FormFieldSchemaType.Email,
required: false,
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
fields: [
{
field: {
adminNotificationEmail: true,
},
title: 'Admin Notification Email',
fieldType: FieldType.Email,
placeholder: 'None',
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
{emailServerType === EmailServerType.Sendgrid ? (
<CardModelDetail<GlobalConfig>
name="Sendgrid Settings"
cardProps={{
title: "Sendgrid Settings",
description:
"Enter your Sendgrid API key to send emails through Sendgrid.",
}}
isEditable={true}
editButtonText="Edit API Key"
formFields={[
{
field: {
sendgridApiKey: true,
},
title: "Sendgrid API Key",
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: "Sendgrid API Key",
},
{
field: {
sendgridFromEmail: true,
},
title: "From Email",
fieldType: FormFieldSchemaType.Email,
required: true,
placeholder: "email@yourcompany.com",
},
{
field: {
sendgridFromName: true,
},
title: "From Name",
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: "Acme, Inc.",
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: "model-detail-global-config",
selectMoreFields: {
sendgridFromEmail: true,
sendgridFromName: true,
},
fields: [
{
field: {
sendgridApiKey: true,
},
title: "",
placeholder: "None",
getElement: (item: GlobalConfig) => {
if (
item["sendgridApiKey"] &&
item["sendgridFromEmail"] &&
item["sendgridFromName"]
) {
return <Pill text="Enabled" color={Green} />;
} else if (!item["sendgridApiKey"]) {
return (
<Pill
text="Not Enabled. Please add the API key."
color={Red}
/>
);
} else if (!item["sendgridFromEmail"]) {
return (
<Pill
text="Not Enabled. Please add the From Email."
color={Red}
/>
);
} else if (!item["sendgridFromName"]) {
return (
<Pill
text="Not Enabled. Please add the From Name."
color={Red}
/>
);
}
<CardModelDetail
name="Internal SMTP Settings"
cardProps={{
title: 'Email Server Settings',
description:
'Pick which email server you would like to use to send emails.',
}}
isEditable={true}
editButtonText="Edit Server"
onSaveSuccess={() => {
window.location.reload();
}}
formFields={[
{
field: {
emailServerType: true,
},
title: 'Email Server Type',
fieldType: FormFieldSchemaType.Dropdown,
dropdownOptions:
DropdownUtil.getDropdownOptionsFromEnum(
EmailServerType
),
required: true,
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
fields: [
{
field: {
emailServerType: true,
},
title: 'Email Server Type',
fieldType: FieldType.Text,
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
{emailServerType === EmailServerType.CustomSMTP ? (
<CardModelDetail
name="Host Settings"
cardProps={{
title: 'Custom Email and SMTP Settings',
description:
'If you have not enabled Internal SMTP server to send emails. Please configure your SMTP server here.',
}}
isEditable={true}
editButtonText="Edit SMTP Config"
formSteps={[
{
title: 'SMTP Server',
id: 'server-info',
},
{
title: 'Authentication',
id: 'authentication',
},
{
title: 'Email',
id: 'email-info',
},
]}
formFields={[
{
field: {
smtpHost: true,
},
title: 'Hostname',
stepId: 'server-info',
fieldType: FormFieldSchemaType.Hostname,
required: true,
placeholder: 'smtp.server.com',
},
{
field: {
smtpPort: true,
},
title: 'Port',
stepId: 'server-info',
fieldType: FormFieldSchemaType.Port,
required: true,
placeholder: '587',
},
{
field: {
isSMTPSecure: true,
},
title: 'Use SSL / TLS',
stepId: 'server-info',
fieldType: FormFieldSchemaType.Toggle,
description:
'If you use port 465, please enable this. Do not enable this if you use port 587.',
},
{
field: {
smtpUsername: true,
},
title: 'Username',
stepId: 'authentication',
fieldType: FormFieldSchemaType.Text,
required: false,
placeholder: 'emailuser',
},
{
field: {
smtpPassword: true,
},
title: 'Password',
stepId: 'authentication',
fieldType: FormFieldSchemaType.EncryptedText,
required: false,
placeholder: 'Password',
},
{
field: {
smtpFromEmail: true,
},
title: 'Email From',
stepId: 'email-info',
fieldType: FormFieldSchemaType.Email,
required: true,
description:
'This is the display email your team and customers see, when they receive emails from OneUptime.',
placeholder: 'email@company.com',
},
{
field: {
smtpFromName: true,
},
title: 'From Name',
stepId: 'email-info',
fieldType: FormFieldSchemaType.Text,
required: true,
description:
'This is the display name your team and customers see, when they receive emails from OneUptime.',
placeholder: 'Company, Inc.',
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
fields: [
{
field: {
smtpHost: true,
},
title: 'SMTP Host',
placeholder: 'None',
},
{
field: {
smtpPort: true,
},
title: 'SMTP Port',
placeholder: 'None',
},
{
field: {
smtpUsername: true,
},
title: 'SMTP Username',
placeholder: 'None',
},
{
field: {
smtpFromEmail: true,
},
title: 'SMTP Email',
placeholder: 'None',
fieldType: FieldType.Email,
},
{
field: {
smtpFromName: true,
},
title: 'SMTP From Name',
placeholder: 'None',
},
{
field: {
isSMTPSecure: true,
},
title: 'Use SSL/TLS',
placeholder: 'No',
fieldType: FieldType.Boolean,
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
) : (
<></>
)}
{emailServerType === EmailServerType.Sendgrid ? (
<CardModelDetail<GlobalConfig>
name="Sendgrid Settings"
cardProps={{
title: 'Sendgrid Settings',
description:
'Enter your Sendgrid API key to send emails through Sendgrid.',
}}
isEditable={true}
editButtonText="Edit API Key"
formFields={[
{
field: {
sendgridApiKey: true,
},
title: 'Sendgrid API Key',
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: 'Sendgrid API Key',
},
{
field: {
sendgridFromEmail: true,
},
title: 'From Email',
fieldType: FormFieldSchemaType.Email,
required: true,
placeholder: 'email@yourcompany.com',
},
{
field: {
sendgridFromName: true,
},
title: 'From Name',
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: 'Acme, Inc.',
},
]}
modelDetailProps={{
modelType: GlobalConfig,
id: 'model-detail-global-config',
selectMoreFields: {
sendgridFromEmail: true,
sendgridFromName: true,
},
fields: [
{
field: {
sendgridApiKey: true,
},
title: '',
placeholder: 'None',
getElement: (item: GlobalConfig) => {
if (
item['sendgridApiKey'] &&
item['sendgridFromEmail'] &&
item['sendgridFromName']
) {
return (
<Pill
text="Enabled"
color={Green}
/>
);
} else if (!item['sendgridApiKey']) {
return (
<Pill
text="Not Enabled. Please add the API key."
color={Red}
/>
);
} else if (!item['sendgridFromEmail']) {
return (
<Pill
text="Not Enabled. Please add the From Email."
color={Red}
/>
);
} else if (!item['sendgridFromName']) {
return (
<Pill
text="Not Enabled. Please add the From Name."
color={Red}
/>
);
}
return <></>;
},
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
) : (
<></>
)}
</Page>
);
return <></>;
},
},
],
modelId: ObjectID.getZeroObjectID(),
}}
/>
) : (
<></>
)}
</Page>
);
};
export default Settings;

View File

@@ -1,251 +1,243 @@
import AdminModelAPI from '../../../Utils/ModelAPI';
import PageMap from '../../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
import DashboardSideMenu from '../SideMenu';
import Route from 'Common/Types/API/Route';
import IsNull from 'Common/Types/BaseDatabase/IsNull';
import { Green, Red } from 'Common/Types/BrandColors';
import OneUptimeDate from 'Common/Types/Date';
import { ErrorFunction, VoidFunction } from 'Common/Types/FunctionTypes';
import Banner from 'CommonUI/src/Components/Banner/Banner';
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import Page from 'CommonUI/src/Components/Page/Page';
import ProbeElement from 'CommonUI/src/Components/Probe/Probe';
import Statusbubble from 'CommonUI/src/Components/StatusBubble/StatusBubble';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import Probe from 'Model/Models/Probe';
import React, { FunctionComponent, ReactElement, useState } from 'react';
import AdminModelAPI from "../../../Utils/ModelAPI";
import PageMap from "../../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../../Utils/RouteMap";
import DashboardSideMenu from "../SideMenu";
import Route from "Common/Types/API/Route";
import IsNull from "Common/Types/BaseDatabase/IsNull";
import { Green, Red } from "Common/Types/BrandColors";
import OneUptimeDate from "Common/Types/Date";
import { ErrorFunction, VoidFunction } from "Common/Types/FunctionTypes";
import Banner from "CommonUI/src/Components/Banner/Banner";
import { ButtonStyleType } from "CommonUI/src/Components/Button/Button";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import ConfirmModal from "CommonUI/src/Components/Modal/ConfirmModal";
import ModelTable from "CommonUI/src/Components/ModelTable/ModelTable";
import Page from "CommonUI/src/Components/Page/Page";
import ProbeElement from "CommonUI/src/Components/Probe/Probe";
import Statusbubble from "CommonUI/src/Components/StatusBubble/StatusBubble";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import Probe from "Model/Models/Probe";
import React, { FunctionComponent, ReactElement, useState } from "react";
const Settings: FunctionComponent = (): ReactElement => {
const [showKeyModal, setShowKeyModal] = useState<boolean>(false);
const [showKeyModal, setShowKeyModal] = useState<boolean>(false);
const [currentProbe, setCurrentProbe] = useState<Probe | null>(null);
const [currentProbe, setCurrentProbe] = useState<Probe | null>(null);
return (
<Page
title={'Admin Settings'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
},
{
title: 'Settings',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route
),
},
{
title: 'Global Probes',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_PROBES] as Route
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
return (
<Page
title={"Admin Settings"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Settings",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS] as Route,
),
},
{
title: "Global Probes",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_PROBES] as Route,
),
},
]}
sideMenu={<DashboardSideMenu />}
>
{/* Project Settings View */}
<Banner
openInNewTab={true}
title="Need help with setting up Global Probes?"
description="Here is a guide which will help you get set up"
link={Route.fromString('/docs/probe/custom-probe')}
/>
<Banner
openInNewTab={true}
title="Need help with setting up Global Probes?"
description="Here is a guide which will help you get set up"
link={Route.fromString("/docs/probe/custom-probe")}
/>
<ModelTable<Probe>
modelType={Probe}
id="probes-table"
name="Settings > Global Probes"
isDeleteable={true}
isEditable={true}
isCreateable={true}
cardProps={{
title: 'Global Probes',
description:
'Global Probes help you monitor external resources from different locations around the world.',
}}
query={{
projectId: new IsNull(),
isGlobalProbe: true,
}}
modelAPI={AdminModelAPI}
noItemsMessage={'No probes found.'}
showRefreshButton={true}
onBeforeCreate={(item: Probe) => {
item.isGlobalProbe = true;
return Promise.resolve(item);
}}
formFields={[
{
field: {
name: true,
},
title: 'Name',
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: 'internal-probe',
validation: {
minLength: 2,
},
},
<ModelTable<Probe>
modelType={Probe}
id="probes-table"
name="Settings > Global Probes"
isDeleteable={true}
isEditable={true}
isCreateable={true}
cardProps={{
title: "Global Probes",
description:
"Global Probes help you monitor external resources from different locations around the world.",
}}
query={{
projectId: new IsNull(),
isGlobalProbe: true,
}}
modelAPI={AdminModelAPI}
noItemsMessage={"No probes found."}
showRefreshButton={true}
onBeforeCreate={(item: Probe) => {
item.isGlobalProbe = true;
return Promise.resolve(item);
}}
formFields={[
{
field: {
name: true,
},
title: "Name",
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: "internal-probe",
validation: {
minLength: 2,
},
},
{
field: {
description: true,
},
title: 'Description',
fieldType: FormFieldSchemaType.LongText,
required: true,
placeholder:
'This probe is to monitor all the internal services.',
},
{
field: {
description: true,
},
title: "Description",
fieldType: FormFieldSchemaType.LongText,
required: true,
placeholder: "This probe is to monitor all the internal services.",
},
{
field: {
iconFile: true,
},
title: 'Probe Logo',
fieldType: FormFieldSchemaType.ImageFile,
required: false,
placeholder: 'Upload logo',
},
]}
selectMoreFields={{
key: true,
iconFileId: true,
}}
actionButtons={[
{
title: 'Show ID and Key',
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: Probe,
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setCurrentProbe(item);
setShowKeyModal(true);
{
field: {
iconFile: true,
},
title: "Probe Logo",
fieldType: FormFieldSchemaType.ImageFile,
required: false,
placeholder: "Upload logo",
},
]}
selectMoreFields={{
key: true,
iconFileId: true,
}}
actionButtons={[
{
title: "Show ID and Key",
buttonStyleType: ButtonStyleType.NORMAL,
onClick: async (
item: Probe,
onCompleteAction: VoidFunction,
onError: ErrorFunction,
) => {
try {
setCurrentProbe(item);
setShowKeyModal(true);
onCompleteAction();
} catch (err) {
onCompleteAction();
onError(err as Error);
}
},
},
]}
filters={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
},
{
field: {
description: true,
},
title: 'Description',
type: FieldType.Text,
},
]}
columns={[
{
field: {
name: true,
},
title: 'Name',
type: FieldType.Text,
onCompleteAction();
} catch (err) {
onCompleteAction();
onError(err as Error);
}
},
},
]}
filters={[
{
field: {
name: true,
},
title: "Name",
type: FieldType.Text,
},
{
field: {
description: true,
},
title: "Description",
type: FieldType.Text,
},
]}
columns={[
{
field: {
name: true,
},
title: "Name",
type: FieldType.Text,
getElement: (item: Probe): ReactElement => {
return <ProbeElement probe={item} />;
},
},
{
field: {
description: true,
},
title: 'Description',
type: FieldType.Text,
},
{
field: {
lastAlive: true,
},
title: 'Status',
type: FieldType.Text,
getElement: (item: Probe): ReactElement => {
if (
item &&
item['lastAlive'] &&
OneUptimeDate.getNumberOfMinutesBetweenDates(
OneUptimeDate.fromString(item['lastAlive']),
OneUptimeDate.getCurrentDate()
) < 5
) {
return (
<Statusbubble
text={'Connected'}
color={Green}
shouldAnimate={true}
/>
);
}
getElement: (item: Probe): ReactElement => {
return <ProbeElement probe={item} />;
},
},
{
field: {
description: true,
},
title: "Description",
type: FieldType.Text,
},
{
field: {
lastAlive: true,
},
title: "Status",
type: FieldType.Text,
getElement: (item: Probe): ReactElement => {
if (
item &&
item["lastAlive"] &&
OneUptimeDate.getNumberOfMinutesBetweenDates(
OneUptimeDate.fromString(item["lastAlive"]),
OneUptimeDate.getCurrentDate(),
) < 5
) {
return (
<Statusbubble
text={"Connected"}
color={Green}
shouldAnimate={true}
/>
);
}
return (
<Statusbubble
text={'Disconnected'}
color={Red}
shouldAnimate={false}
/>
);
},
},
]}
/>
{showKeyModal && currentProbe ? (
<ConfirmModal
title={`Probe Key`}
description={
<div>
<span>
Here is your probe key. Please keep this a
secret.
</span>
<br />
<br />
<span>
<b>Probe ID: </b>{' '}
{currentProbe['_id']?.toString()}
</span>
<br />
<br />
<span>
<b>Probe Key: </b>{' '}
{currentProbe['key']?.toString()}
</span>
</div>
}
submitButtonText={'Close'}
submitButtonType={ButtonStyleType.NORMAL}
onSubmit={async () => {
setShowKeyModal(false);
}}
return (
<Statusbubble
text={"Disconnected"}
color={Red}
shouldAnimate={false}
/>
) : (
<></>
)}
</Page>
);
);
},
},
]}
/>
{showKeyModal && currentProbe ? (
<ConfirmModal
title={`Probe Key`}
description={
<div>
<span>Here is your probe key. Please keep this a secret.</span>
<br />
<br />
<span>
<b>Probe ID: </b> {currentProbe["_id"]?.toString()}
</span>
<br />
<br />
<span>
<b>Probe Key: </b> {currentProbe["key"]?.toString()}
</span>
</div>
}
submitButtonText={"Close"}
submitButtonType={ButtonStyleType.NORMAL}
onSubmit={async () => {
setShowKeyModal(false);
}}
/>
) : (
<></>
)}
</Page>
);
};
export default Settings;

View File

@@ -1,17 +1,17 @@
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import Route from 'Common/Types/API/Route';
import IconProp from 'Common/Types/Icon/IconProp';
import SideMenu from 'CommonUI/src/Components/SideMenu/SideMenu';
import SideMenuItem from 'CommonUI/src/Components/SideMenu/SideMenuItem';
import SideMenuSection from 'CommonUI/src/Components/SideMenu/SideMenuSection';
import React, { ReactElement } from 'react';
import PageMap from "../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
import Route from "Common/Types/API/Route";
import IconProp from "Common/Types/Icon/IconProp";
import SideMenu from "CommonUI/src/Components/SideMenu/SideMenu";
import SideMenuItem from "CommonUI/src/Components/SideMenu/SideMenuItem";
import SideMenuSection from "CommonUI/src/Components/SideMenu/SideMenuSection";
import React, { ReactElement } from "react";
const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
return (
<SideMenu>
<SideMenuSection title="Basic">
{/* <SideMenuItem
return (
<SideMenu>
<SideMenuSection title="Basic">
{/* <SideMenuItem
link={{
title: 'Host',
to: RouteUtil.populateRouteParams(
@@ -20,62 +20,62 @@ const DashboardSideMenu: () => JSX.Element = (): ReactElement => {
}}
icon={IconProp.Globe}
/> */}
<SideMenuItem
link={{
title: 'Authentication',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_AUTHENTICATION] as Route
),
}}
icon={IconProp.Lock}
/>
</SideMenuSection>
<SideMenuItem
link={{
title: "Authentication",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_AUTHENTICATION] as Route,
),
}}
icon={IconProp.Lock}
/>
</SideMenuSection>
<SideMenuSection title="Notifications">
<SideMenuItem
link={{
title: 'Emails',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_SMTP] as Route
),
}}
icon={IconProp.Email}
/>
<SideMenuItem
link={{
title: 'Call and SMS',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_CALL_AND_SMS] as Route
),
}}
icon={IconProp.Call}
/>
</SideMenuSection>
<SideMenuSection title="Notifications">
<SideMenuItem
link={{
title: "Emails",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_SMTP] as Route,
),
}}
icon={IconProp.Email}
/>
<SideMenuItem
link={{
title: "Call and SMS",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_CALL_AND_SMS] as Route,
),
}}
icon={IconProp.Call}
/>
</SideMenuSection>
<SideMenuSection title="Monitoring">
<SideMenuItem
link={{
title: 'Global Probes',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_PROBES] as Route
),
}}
icon={IconProp.Signal}
/>
</SideMenuSection>
<SideMenuSection title="API and Integrations">
<SideMenuItem
link={{
title: 'API Key',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_API_KEY] as Route
),
}}
icon={IconProp.Code}
/>
</SideMenuSection>
</SideMenu>
);
<SideMenuSection title="Monitoring">
<SideMenuItem
link={{
title: "Global Probes",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_PROBES] as Route,
),
}}
icon={IconProp.Signal}
/>
</SideMenuSection>
<SideMenuSection title="API and Integrations">
<SideMenuItem
link={{
title: "API Key",
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.SETTINGS_API_KEY] as Route,
),
}}
icon={IconProp.Code}
/>
</SideMenuSection>
</SideMenu>
);
};
export default DashboardSideMenu;

View File

@@ -1,222 +1,218 @@
import PageMap from '../../Utils/PageMap';
import RouteMap, { RouteUtil } from '../../Utils/RouteMap';
import Route from 'Common/Types/API/Route';
import { ErrorFunction } from 'Common/Types/FunctionTypes';
import { ButtonStyleType } from 'CommonUI/src/Components/Button/Button';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import ConfirmModal from 'CommonUI/src/Components/Modal/ConfirmModal';
import ModelTable from 'CommonUI/src/Components/ModelTable/ModelTable';
import Page from 'CommonUI/src/Components/Page/Page';
import FieldType from 'CommonUI/src/Components/Types/FieldType';
import API from 'CommonUI/src/Utils/API/API';
import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import Navigation from 'CommonUI/src/Utils/Navigation';
import User from 'Model/Models/User';
import React, { FunctionComponent, ReactElement, useState } from 'react';
import PageMap from "../../Utils/PageMap";
import RouteMap, { RouteUtil } from "../../Utils/RouteMap";
import Route from "Common/Types/API/Route";
import { ErrorFunction } from "Common/Types/FunctionTypes";
import { ButtonStyleType } from "CommonUI/src/Components/Button/Button";
import FormFieldSchemaType from "CommonUI/src/Components/Forms/Types/FormFieldSchemaType";
import ConfirmModal from "CommonUI/src/Components/Modal/ConfirmModal";
import ModelTable from "CommonUI/src/Components/ModelTable/ModelTable";
import Page from "CommonUI/src/Components/Page/Page";
import FieldType from "CommonUI/src/Components/Types/FieldType";
import API from "CommonUI/src/Utils/API/API";
import ModelAPI from "CommonUI/src/Utils/ModelAPI/ModelAPI";
import Navigation from "CommonUI/src/Utils/Navigation";
import User from "Model/Models/User";
import React, { FunctionComponent, ReactElement, useState } from "react";
const Users: FunctionComponent = (): ReactElement => {
const [showConfirmVerifyEmailModal, setShowConfirmVerifyEmailModal] =
useState<boolean>(false);
const [selectedUser, setSelectedUser] = useState<User | null>(null);
const [error, setError] = useState<string | null>(null);
const [showConfirmVerifyEmailModal, setShowConfirmVerifyEmailModal] =
useState<boolean>(false);
const [selectedUser, setSelectedUser] = useState<User | null>(null);
const [error, setError] = useState<string | null>(null);
const [isConfimModalLoading, setIsConfirmModalLoading] =
useState<boolean>(false);
const [isConfimModalLoading, setIsConfirmModalLoading] =
useState<boolean>(false);
const [refreshItemsTrigger, setRefreshItemsTrigger] =
useState<boolean>(false);
const [refreshItemsTrigger, setRefreshItemsTrigger] =
useState<boolean>(false);
return (
<Page
title={'Users'}
breadcrumbLinks={[
{
title: 'Admin Dashboard',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.HOME] as Route
),
return (
<Page
title={"Users"}
breadcrumbLinks={[
{
title: "Admin Dashboard",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
},
{
title: "Users",
to: RouteUtil.populateRouteParams(RouteMap[PageMap.USERS] as Route),
},
]}
>
<ModelTable<User>
modelType={User}
id="users-table"
isDeleteable={false}
isEditable={false}
showViewIdButton={true}
refreshToggle={refreshItemsTrigger}
isCreateable={true}
name="Users"
isViewable={false}
cardProps={{
title: "Users",
description: "Here is a list of users in OneUptime.",
}}
actionButtons={[
{
title: "Verify Email",
buttonStyleType: ButtonStyleType.NORMAL,
isVisible: (item: User) => {
return !item.isEmailVerified;
},
onClick: async (
item: User,
onCompleteAction: VoidFunction,
onError: ErrorFunction,
) => {
try {
setSelectedUser(item);
setShowConfirmVerifyEmailModal(true);
onCompleteAction();
} catch (err) {
onCompleteAction();
onError(err as Error);
}
},
},
]}
noItemsMessage={"No users found."}
formFields={[
{
field: {
email: true,
},
title: "Email",
fieldType: FormFieldSchemaType.Email,
required: true,
placeholder: "email@company.com",
},
{
field: {
password: true,
},
title: "Password",
fieldType: FormFieldSchemaType.Password,
required: true,
placeholder: "Password",
},
{
field: {
name: true,
},
title: "Full Name",
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: "John Smith",
},
]}
showRefreshButton={true}
viewPageRoute={Navigation.getCurrentRoute()}
filters={[
{
field: {
name: true,
},
title: "Full Name",
type: FieldType.Text,
},
{
field: {
email: true,
},
title: "Email",
type: FieldType.Email,
},
{
field: {
createdAt: true,
},
title: "Created At",
type: FieldType.DateTime,
},
]}
columns={[
{
field: {
name: true,
},
title: "Full Name",
type: FieldType.Text,
},
{
field: {
email: true,
},
title: "Email",
type: FieldType.Email,
},
{
field: {
isEmailVerified: true,
},
title: "Email Verified",
type: FieldType.Boolean,
},
{
field: {
createdAt: true,
},
title: "Created At",
type: FieldType.DateTime,
},
]}
/>
{error ? (
<ConfirmModal
title={`Error`}
description={error}
submitButtonText={"Close"}
onSubmit={async () => {
setError(null);
}}
submitButtonType={ButtonStyleType.NORMAL}
/>
) : (
<></>
)}
{showConfirmVerifyEmailModal && selectedUser ? (
<ConfirmModal
title={`Verify Email`}
description={`Are you sure you want to verify the email - ${selectedUser.email}?`}
isLoading={isConfimModalLoading}
submitButtonText={"Verify Email"}
onClose={async () => {
setShowConfirmVerifyEmailModal(false);
setSelectedUser(null);
}}
onSubmit={async () => {
try {
setIsConfirmModalLoading(true);
await ModelAPI.updateById<User>({
modelType: User,
id: selectedUser.id!,
data: {
isEmailVerified: true,
},
{
title: 'Users',
to: RouteUtil.populateRouteParams(
RouteMap[PageMap.USERS] as Route
),
},
]}
>
<ModelTable<User>
modelType={User}
id="users-table"
isDeleteable={false}
isEditable={false}
showViewIdButton={true}
refreshToggle={refreshItemsTrigger}
isCreateable={true}
name="Users"
isViewable={false}
cardProps={{
title: 'Users',
description: 'Here is a list of users in OneUptime.',
}}
actionButtons={[
{
title: 'Verify Email',
buttonStyleType: ButtonStyleType.NORMAL,
isVisible: (item: User) => {
return !item.isEmailVerified;
},
onClick: async (
item: User,
onCompleteAction: VoidFunction,
onError: ErrorFunction
) => {
try {
setSelectedUser(item);
setShowConfirmVerifyEmailModal(true);
});
} catch (err) {
setError(API.getFriendlyMessage(err as Error));
}
onCompleteAction();
} catch (err) {
onCompleteAction();
onError(err as Error);
}
},
},
]}
noItemsMessage={'No users found.'}
formFields={[
{
field: {
email: true,
},
title: 'Email',
fieldType: FormFieldSchemaType.Email,
required: true,
placeholder: 'email@company.com',
},
{
field: {
password: true,
},
title: 'Password',
fieldType: FormFieldSchemaType.Password,
required: true,
placeholder: 'Password',
},
{
field: {
name: true,
},
title: 'Full Name',
fieldType: FormFieldSchemaType.Text,
required: true,
placeholder: 'John Smith',
},
]}
showRefreshButton={true}
viewPageRoute={Navigation.getCurrentRoute()}
filters={[
{
field: {
name: true,
},
title: 'Full Name',
type: FieldType.Text,
},
{
field: {
email: true,
},
title: 'Email',
type: FieldType.Email,
},
{
field: {
createdAt: true,
},
title: 'Created At',
type: FieldType.DateTime,
},
]}
columns={[
{
field: {
name: true,
},
title: 'Full Name',
type: FieldType.Text,
},
{
field: {
email: true,
},
title: 'Email',
type: FieldType.Email,
},
{
field: {
isEmailVerified: true,
},
title: 'Email Verified',
type: FieldType.Boolean,
},
{
field: {
createdAt: true,
},
title: 'Created At',
type: FieldType.DateTime,
},
]}
/>
{error ? (
<ConfirmModal
title={`Error`}
description={error}
submitButtonText={'Close'}
onSubmit={async () => {
setError(null);
}}
submitButtonType={ButtonStyleType.NORMAL}
/>
) : (
<></>
)}
{showConfirmVerifyEmailModal && selectedUser ? (
<ConfirmModal
title={`Verify Email`}
description={`Are you sure you want to verify the email - ${selectedUser.email}?`}
isLoading={isConfimModalLoading}
submitButtonText={'Verify Email'}
onClose={async () => {
setShowConfirmVerifyEmailModal(false);
setSelectedUser(null);
}}
onSubmit={async () => {
try {
setIsConfirmModalLoading(true);
await ModelAPI.updateById<User>({
modelType: User,
id: selectedUser.id!,
data: {
isEmailVerified: true,
},
});
} catch (err) {
setError(API.getFriendlyMessage(err as Error));
}
setRefreshItemsTrigger(!refreshItemsTrigger);
setIsConfirmModalLoading(false);
setShowConfirmVerifyEmailModal(false);
}}
/>
) : (
<></>
)}
</Page>
);
setRefreshItemsTrigger(!refreshItemsTrigger);
setIsConfirmModalLoading(false);
setShowConfirmVerifyEmailModal(false);
}}
/>
) : (
<></>
)}
</Page>
);
};
export default Users;

View File

@@ -1,8 +1,8 @@
import Dictionary from 'Common/Types/Dictionary';
import ModelAPI from 'CommonUI/src/Utils/ModelAPI/ModelAPI';
import Dictionary from "Common/Types/Dictionary";
import ModelAPI from "CommonUI/src/Utils/ModelAPI/ModelAPI";
export default class AdminModelAPI extends ModelAPI {
public static override getCommonHeaders(): Dictionary<string> {
return {};
}
public static override getCommonHeaders(): Dictionary<string> {
return {};
}
}

View File

@@ -1,17 +1,17 @@
enum PageMap {
INIT = 'INIT',
HOME = 'HOME',
LOGOUT = 'LOGOUT',
SETTINGS = 'SETTINGS',
USERS = 'USERS',
PROJECTS = 'PROJECTS',
INIT = "INIT",
HOME = "HOME",
LOGOUT = "LOGOUT",
SETTINGS = "SETTINGS",
USERS = "USERS",
PROJECTS = "PROJECTS",
SETTINGS_HOST = 'SETTINGS_HOST',
SETTINGS_SMTP = 'SETTINGS_SMTP',
SETTINGS_CALL_AND_SMS = 'SETTINGS_CALL_AND_SMS',
SETTINGS_PROBES = 'SETTINGS_PROBES',
SETTINGS_AUTHENTICATION = 'SETTINGS_AUTHENTICATION',
SETTINGS_API_KEY = 'SETTINGS_API_KEY',
SETTINGS_HOST = "SETTINGS_HOST",
SETTINGS_SMTP = "SETTINGS_SMTP",
SETTINGS_CALL_AND_SMS = "SETTINGS_CALL_AND_SMS",
SETTINGS_PROBES = "SETTINGS_PROBES",
SETTINGS_AUTHENTICATION = "SETTINGS_AUTHENTICATION",
SETTINGS_API_KEY = "SETTINGS_API_KEY",
}
export default PageMap;

View File

@@ -1,54 +1,54 @@
import PageMap from './PageMap';
import RouteParams from './RouteParams';
import Route from 'Common/Types/API/Route';
import Dictionary from 'Common/Types/Dictionary';
import ObjectID from 'Common/Types/ObjectID';
import PageMap from "./PageMap";
import RouteParams from "./RouteParams";
import Route from "Common/Types/API/Route";
import Dictionary from "Common/Types/Dictionary";
import ObjectID from "Common/Types/ObjectID";
const RouteMap: Dictionary<Route> = {
[PageMap.INIT]: new Route(`/admin`),
[PageMap.HOME]: new Route(`/admin`),
[PageMap.LOGOUT]: new Route(`/admin/logout`),
[PageMap.SETTINGS]: new Route(`/admin/settings/host`),
[PageMap.PROJECTS]: new Route(`/admin/projects`),
[PageMap.USERS]: new Route(`/admin/users`),
[PageMap.SETTINGS_HOST]: new Route(`/admin/settings/host`),
[PageMap.SETTINGS_SMTP]: new Route(`/admin/settings/smtp`),
[PageMap.SETTINGS_CALL_AND_SMS]: new Route(`/admin/settings/call-and-sms`),
[PageMap.SETTINGS_PROBES]: new Route(`/admin/settings/probes`),
[PageMap.SETTINGS_AUTHENTICATION]: new Route(
`/admin/settings/authentication`
),
[PageMap.SETTINGS_API_KEY]: new Route(`/admin/settings/api-key`),
[PageMap.INIT]: new Route(`/admin`),
[PageMap.HOME]: new Route(`/admin`),
[PageMap.LOGOUT]: new Route(`/admin/logout`),
[PageMap.SETTINGS]: new Route(`/admin/settings/host`),
[PageMap.PROJECTS]: new Route(`/admin/projects`),
[PageMap.USERS]: new Route(`/admin/users`),
[PageMap.SETTINGS_HOST]: new Route(`/admin/settings/host`),
[PageMap.SETTINGS_SMTP]: new Route(`/admin/settings/smtp`),
[PageMap.SETTINGS_CALL_AND_SMS]: new Route(`/admin/settings/call-and-sms`),
[PageMap.SETTINGS_PROBES]: new Route(`/admin/settings/probes`),
[PageMap.SETTINGS_AUTHENTICATION]: new Route(
`/admin/settings/authentication`,
),
[PageMap.SETTINGS_API_KEY]: new Route(`/admin/settings/api-key`),
};
export class RouteUtil {
public static populateRouteParams(
route: Route,
props?: {
modelId?: ObjectID;
subModelId?: ObjectID;
}
): Route {
// populate projectid
public static populateRouteParams(
route: Route,
props?: {
modelId?: ObjectID;
subModelId?: ObjectID;
},
): Route {
// populate projectid
const tempRoute: Route = new Route(route.toString());
const tempRoute: Route = new Route(route.toString());
if (props && props.modelId) {
route = tempRoute.addRouteParam(
RouteParams.ModelID,
props.modelId.toString()
);
}
if (props && props.subModelId) {
route = tempRoute.addRouteParam(
RouteParams.SubModelID,
props.subModelId.toString()
);
}
return tempRoute;
if (props && props.modelId) {
route = tempRoute.addRouteParam(
RouteParams.ModelID,
props.modelId.toString(),
);
}
if (props && props.subModelId) {
route = tempRoute.addRouteParam(
RouteParams.SubModelID,
props.subModelId.toString(),
);
}
return tempRoute;
}
}
export default RouteMap;

View File

@@ -1,6 +1,6 @@
enum RouteParams {
ModelID = ':id',
SubModelID = ':subModelId',
ModelID = ":id",
SubModelID = ":subModelId",
}
export default RouteParams;

View File

@@ -1,82 +1,84 @@
require('ts-loader');
require('file-loader');
require('style-loader');
require('css-loader');
require('sass-loader');
require("ts-loader");
require("file-loader");
require("style-loader");
require("css-loader");
require("sass-loader");
const path = require("path");
const webpack = require("webpack");
const dotenv = require('dotenv');
const express = require('express');
const dotenv = require("dotenv");
const express = require("express");
const readEnvFile = (pathToFile) => {
const parsed = dotenv.config({ path: pathToFile }).parsed;
const parsed = dotenv.config({ path: pathToFile }).parsed;
const env = {};
const env = {};
for (const key in parsed) {
env[key] = JSON.stringify(parsed[key]);
}
for (const key in parsed) {
env[key] = JSON.stringify(parsed[key]);
}
return env;
}
return env;
};
module.exports = {
entry: "./src/Index.tsx",
mode: "development",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "public", "dist"),
publicPath: "/admin/dist/",
entry: "./src/Index.tsx",
mode: "development",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "public", "dist"),
publicPath: "/admin/dist/",
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json", ".css", ".scss"],
alias: {
react: path.resolve("./node_modules/react"),
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json', '.css', '.scss'],
alias: {
react: path.resolve('./node_modules/react'),
}
},
externals: {
'react-native-sqlite-storage': 'react-native-sqlite-storage'
},
plugins: [
new webpack.DefinePlugin({
'process': {
'env': {
...readEnvFile('/usr/src/app/dev-env/.env')
}
}
}),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: 'ts-loader'
},
{
test: /\.s[ac]ss$/i,
use: ['style-loader', 'css-loader', "sass-loader"]
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader']
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'file-loader'
}
],
},
devServer: {
historyApiFallback: true,
devMiddleware: {
writeToDisk: true,
},
externals: {
"react-native-sqlite-storage": "react-native-sqlite-storage",
},
plugins: [
new webpack.DefinePlugin({
process: {
env: {
...readEnvFile("/usr/src/app/dev-env/.env"),
},
allowedHosts: "all",
setupMiddlewares: (middlewares, devServer) => {
devServer.app.use('/admin/assets', express.static(path.resolve(__dirname, 'public', 'assets')));
return middlewares;
}
},
}),
],
module: {
rules: [
{
test: /\.(ts|tsx)$/,
use: "ts-loader",
},
{
test: /\.s[ac]ss$/i,
use: ["style-loader", "css-loader", "sass-loader"],
},
{
test: /\.css$/i,
use: ["style-loader", "css-loader"],
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: "file-loader",
},
],
},
devServer: {
historyApiFallback: true,
devMiddleware: {
writeToDisk: true,
},
devtool: 'eval-source-map',
}
allowedHosts: "all",
setupMiddlewares: (middlewares, devServer) => {
devServer.app.use(
"/admin/assets",
express.static(path.resolve(__dirname, "public", "assets")),
);
return middlewares;
},
},
devtool: "eval-source-map",
};

View File

@@ -1,89 +1,83 @@
import AuthenticationServiceHandler from './Service/Authentication';
import DataTypeServiceHandler from './Service/DataType';
import ErrorServiceHandler from './Service/Errors';
import IntroductionServiceHandler from './Service/Introduction';
import ModelServiceHandler from './Service/Model';
import PageNotFoundServiceHandler from './Service/PageNotFound';
import PaginationServiceHandler from './Service/Pagination';
import PermissionServiceHandler from './Service/Permissions';
import StatusServiceHandler from './Service/Status';
import { StaticPath } from './Utils/Config';
import ResourceUtil, { ModelDocumentation } from './Utils/Resources';
import Dictionary from 'Common/Types/Dictionary';
import FeatureSet from 'CommonServer/Types/FeatureSet';
import AuthenticationServiceHandler from "./Service/Authentication";
import DataTypeServiceHandler from "./Service/DataType";
import ErrorServiceHandler from "./Service/Errors";
import IntroductionServiceHandler from "./Service/Introduction";
import ModelServiceHandler from "./Service/Model";
import PageNotFoundServiceHandler from "./Service/PageNotFound";
import PaginationServiceHandler from "./Service/Pagination";
import PermissionServiceHandler from "./Service/Permissions";
import StatusServiceHandler from "./Service/Status";
import { StaticPath } from "./Utils/Config";
import ResourceUtil, { ModelDocumentation } from "./Utils/Resources";
import Dictionary from "Common/Types/Dictionary";
import FeatureSet from "CommonServer/Types/FeatureSet";
import Express, {
ExpressApplication,
ExpressRequest,
ExpressResponse,
ExpressStatic,
} from 'CommonServer/Utils/Express';
ExpressApplication,
ExpressRequest,
ExpressResponse,
ExpressStatic,
} from "CommonServer/Utils/Express";
const APIReferenceFeatureSet: FeatureSet = {
init: async (): Promise<void> => {
const ResourceDictionary: Dictionary<ModelDocumentation> =
ResourceUtil.getResourceDictionaryByPath();
init: async (): Promise<void> => {
const ResourceDictionary: Dictionary<ModelDocumentation> =
ResourceUtil.getResourceDictionaryByPath();
const app: ExpressApplication = Express.getExpressApp();
const app: ExpressApplication = Express.getExpressApp();
app.use('/reference', ExpressStatic(StaticPath, { maxAge: 2592000 }));
app.use("/reference", ExpressStatic(StaticPath, { maxAge: 2592000 }));
// Index page
app.get(
['/reference'],
(_req: ExpressRequest, res: ExpressResponse) => {
return res.redirect('/reference/introduction');
}
);
// Index page
app.get(["/reference"], (_req: ExpressRequest, res: ExpressResponse) => {
return res.redirect("/reference/introduction");
});
app.get(
['/reference/page-not-found'],
(req: ExpressRequest, res: ExpressResponse) => {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
);
app.get(
["/reference/page-not-found"],
(req: ExpressRequest, res: ExpressResponse) => {
return PageNotFoundServiceHandler.executeResponse(req, res);
},
);
// All Pages
app.get(
['/reference/:page'],
(req: ExpressRequest, res: ExpressResponse) => {
const page: string | undefined = req.params['page'];
// All Pages
app.get(
["/reference/:page"],
(req: ExpressRequest, res: ExpressResponse) => {
const page: string | undefined = req.params["page"];
if (!page) {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
if (!page) {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
const currentResource: ModelDocumentation | undefined =
ResourceDictionary[page];
const currentResource: ModelDocumentation | undefined =
ResourceDictionary[page];
if (req.params['page'] === 'permissions') {
return PermissionServiceHandler.executeResponse(req, res);
} else if (req.params['page'] === 'authentication') {
return AuthenticationServiceHandler.executeResponse(
req,
res
);
} else if (req.params['page'] === 'pagination') {
return PaginationServiceHandler.executeResponse(req, res);
} else if (req.params['page'] === 'errors') {
return ErrorServiceHandler.executeResponse(req, res);
} else if (req.params['page'] === 'introduction') {
return IntroductionServiceHandler.executeResponse(req, res);
} else if (req.params['page'] === 'status') {
return StatusServiceHandler.executeResponse(req, res);
} else if (req.params['page'] === 'data-types') {
return DataTypeServiceHandler.executeResponse(req, res);
} else if (currentResource) {
return ModelServiceHandler.executeResponse(req, res);
}
// page not found
return PageNotFoundServiceHandler.executeResponse(req, res);
}
);
if (req.params["page"] === "permissions") {
return PermissionServiceHandler.executeResponse(req, res);
} else if (req.params["page"] === "authentication") {
return AuthenticationServiceHandler.executeResponse(req, res);
} else if (req.params["page"] === "pagination") {
return PaginationServiceHandler.executeResponse(req, res);
} else if (req.params["page"] === "errors") {
return ErrorServiceHandler.executeResponse(req, res);
} else if (req.params["page"] === "introduction") {
return IntroductionServiceHandler.executeResponse(req, res);
} else if (req.params["page"] === "status") {
return StatusServiceHandler.executeResponse(req, res);
} else if (req.params["page"] === "data-types") {
return DataTypeServiceHandler.executeResponse(req, res);
} else if (currentResource) {
return ModelServiceHandler.executeResponse(req, res);
}
// page not found
return PageNotFoundServiceHandler.executeResponse(req, res);
},
);
app.get('/reference/*', (req: ExpressRequest, res: ExpressResponse) => {
return PageNotFoundServiceHandler.executeResponse(req, res);
});
},
app.get("/reference/*", (req: ExpressRequest, res: ExpressResponse) => {
return PageNotFoundServiceHandler.executeResponse(req, res);
});
},
};
export default APIReferenceFeatureSet;

View File

@@ -1,29 +1,28 @@
import { ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
const page: string | undefined = req.params['page'];
const pageData: any = {};
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
let pageTitle: string = "";
let pageDescription: string = "";
const page: string | undefined = req.params["page"];
const pageData: any = {};
pageTitle = 'Authentication';
pageDescription =
'Learn how to authenticate requests with OneUptime API';
pageTitle = "Authentication";
pageDescription = "Learn how to authenticate requests with OneUptime API";
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
}

View File

@@ -1,136 +1,126 @@
import { CodeExamplesPath, ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import LocalCache from 'CommonServer/Infrastructure/LocalCache';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import LocalFile from 'CommonServer/Utils/LocalFile';
import { CodeExamplesPath, ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import LocalCache from "CommonServer/Infrastructure/LocalCache";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
import LocalFile from "CommonServer/Utils/LocalFile";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
export default class ServiceHandler {
public static async executeResponse(
_req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
const pageData: any = {};
public static async executeResponse(
_req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
const pageData: any = {};
pageData.selectCode = await LocalCache.getOrSetString(
'data-type',
'select',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/Select.md`
);
}
pageData.selectCode = await LocalCache.getOrSetString(
"data-type",
"select",
async () => {
return await LocalFile.read(`${CodeExamplesPath}/DataTypes/Select.md`);
},
);
pageData.sortCode = await LocalCache.getOrSetString(
"data-type",
"sort",
async () => {
return await LocalFile.read(`${CodeExamplesPath}/DataTypes/Sort.md`);
},
);
pageData.equalToCode = await LocalCache.getOrSetString(
"data-type",
"equal-to",
async () => {
return await LocalFile.read(`${CodeExamplesPath}/DataTypes/EqualTo.md`);
},
);
pageData.equalToOrNullCode = await LocalCache.getOrSetString(
"data-type",
"equal-to-or-null",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/EqualToOrNull.md`,
);
},
);
pageData.sortCode = await LocalCache.getOrSetString(
'data-type',
'sort',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/Sort.md`
);
}
pageData.greaterThanCode = await LocalCache.getOrSetString(
"data-type",
"greater-than",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/GreaterThan.md`,
);
},
);
pageData.equalToCode = await LocalCache.getOrSetString(
'data-type',
'equal-to',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/EqualTo.md`
);
}
pageData.greaterThanOrEqualCode = await LocalCache.getOrSetString(
"data-type",
"greater-than-or-equal",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/GreaterThanOrEqual.md`,
);
},
);
pageData.equalToOrNullCode = await LocalCache.getOrSetString(
'data-type',
'equal-to-or-null',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/EqualToOrNull.md`
);
}
pageData.lessThanCode = await LocalCache.getOrSetString(
"data-type",
"less-than",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/LessThan.md`,
);
},
);
pageData.greaterThanCode = await LocalCache.getOrSetString(
'data-type',
'greater-than',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/GreaterThan.md`
);
}
pageData.lessThanOrEqualCode = await LocalCache.getOrSetString(
"data-type",
"less-than-or-equal",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/LessThanOrEqual.md`,
);
},
);
pageData.greaterThanOrEqualCode = await LocalCache.getOrSetString(
'data-type',
'greater-than-or-equal',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/GreaterThanOrEqual.md`
);
}
pageData.isNullCode = await LocalCache.getOrSetString(
"data-type",
"is-null",
async () => {
return await LocalFile.read(`${CodeExamplesPath}/DataTypes/IsNull.md`);
},
);
pageData.notNullCode = await LocalCache.getOrSetString(
"data-type",
"not-null",
async () => {
return await LocalFile.read(`${CodeExamplesPath}/DataTypes/NotNull.md`);
},
);
pageData.notEqualToCode = await LocalCache.getOrSetString(
"data-type",
"not-equals",
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/NotEqualTo.md`,
);
},
);
pageData.lessThanCode = await LocalCache.getOrSetString(
'data-type',
'less-than',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/LessThan.md`
);
}
);
pageData.lessThanOrEqualCode = await LocalCache.getOrSetString(
'data-type',
'less-than-or-equal',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/LessThanOrEqual.md`
);
}
);
pageData.isNullCode = await LocalCache.getOrSetString(
'data-type',
'is-null',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/IsNull.md`
);
}
);
pageData.notNullCode = await LocalCache.getOrSetString(
'data-type',
'not-null',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/NotNull.md`
);
}
);
pageData.notEqualToCode = await LocalCache.getOrSetString(
'data-type',
'not-equals',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/DataTypes/NotEqualTo.md`
);
}
);
res.status(200);
return res.render(`${ViewsPath}/pages/index`, {
page: 'data-types',
pageTitle: 'Data Types',
pageDescription:
'Data Types that can be used to interact with OneUptime API',
resources: Resources,
pageData: pageData,
});
}
res.status(200);
return res.render(`${ViewsPath}/pages/index`, {
page: "data-types",
pageTitle: "Data Types",
pageDescription:
"Data Types that can be used to interact with OneUptime API",
resources: Resources,
pageData: pageData,
});
}
}

View File

@@ -1,28 +1,28 @@
import { ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
const page: string | undefined = req.params['page'];
const pageData: any = {};
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
let pageTitle: string = "";
let pageDescription: string = "";
const page: string | undefined = req.params["page"];
const pageData: any = {};
pageTitle = 'Errors';
pageDescription = 'Learn more about how we return errors from API';
pageTitle = "Errors";
pageDescription = "Learn more about how we return errors from API";
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
}

View File

@@ -1,31 +1,40 @@
import { ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
// Get all resources and featured resources from ResourceUtil
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const FeaturedResources: Array<ModelDocumentation> =
ResourceUtil.getFeaturedResources();
ResourceUtil.getFeaturedResources();
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
const page: string | undefined = req.params['page'];
const pageData: any = {};
// Handle the API request
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
// Initialize page title and description
let pageTitle: string = "";
let pageDescription: string = "";
pageData.featuredResources = FeaturedResources;
pageTitle = 'Introduction';
pageDescription = 'API Reference for OneUptime';
// Get the requested page from the URL parameters
const page: string | undefined = req.params["page"];
const pageData: any = {};
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
// Set featured resources for the page
pageData.featuredResources = FeaturedResources;
// Set page title and description
pageTitle = "Introduction";
pageDescription = "API Reference for OneUptime";
// Render the index page with the required data
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
}

View File

@@ -1,244 +1,269 @@
import { CodeExamplesPath, ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import PageNotFoundServiceHandler from './PageNotFound';
import { AppApiRoute } from 'Common/ServiceRoute';
import { ColumnAccessControl } from 'Common/Types/BaseDatabase/AccessControl';
import { getTableColumns } from 'Common/Types/Database/TableColumn';
import Dictionary from 'Common/Types/Dictionary';
import ObjectID from 'Common/Types/ObjectID';
import { CodeExamplesPath, ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import PageNotFoundServiceHandler from "./PageNotFound";
import { AppApiRoute } from "Common/ServiceRoute";
import { ColumnAccessControl } from "Common/Types/BaseDatabase/AccessControl";
import { getTableColumns } from "Common/Types/Database/TableColumn";
import Dictionary from "Common/Types/Dictionary";
import ObjectID from "Common/Types/ObjectID";
import Permission, {
PermissionHelper,
PermissionProps,
} from 'Common/Types/Permission';
import LocalCache from 'CommonServer/Infrastructure/LocalCache';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import LocalFile from 'CommonServer/Utils/LocalFile';
PermissionHelper,
PermissionProps,
} from "Common/Types/Permission";
import LocalCache from "CommonServer/Infrastructure/LocalCache";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
import LocalFile from "CommonServer/Utils/LocalFile";
// Get all resources and resource dictionary
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const ResourceDictionary: Dictionary<ModelDocumentation> =
ResourceUtil.getResourceDictionaryByPath();
ResourceUtil.getResourceDictionaryByPath();
// Get all permission props
const PermissionDictionary: Dictionary<PermissionProps> =
PermissionHelper.getAllPermissionPropsAsDictionary();
PermissionHelper.getAllPermissionPropsAsDictionary();
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
let page: string | undefined = req.params['page'];
const pageData: any = {};
// Execute response for a given page
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
let pageTitle: string = "";
let pageDescription: string = "";
let page: string | undefined = req.params["page"];
const pageData: any = {};
if (!page) {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
const currentResource: ModelDocumentation | undefined =
ResourceDictionary[page];
if (!currentResource) {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
// Resource Page.
pageTitle = currentResource.name;
pageDescription = currentResource.description;
page = 'model';
const tableColumns: any = getTableColumns(currentResource.model);
for (const key in tableColumns) {
const accessControl: ColumnAccessControl | null =
currentResource.model.getColumnAccessControlFor(key);
if (!accessControl) {
// remove columns with no access
delete tableColumns[key];
continue;
}
if (
accessControl?.create.length === 0 &&
accessControl?.read.length === 0 &&
accessControl?.update.length === 0
) {
// remove columns with no access
delete tableColumns[key];
continue;
}
tableColumns[key].permissions = accessControl;
}
delete tableColumns['deletedAt'];
delete tableColumns['deletedByUserId'];
delete tableColumns['deletedByUser'];
delete tableColumns['version'];
pageData.title = currentResource.model.singularName;
pageData.description = currentResource.model.tableDescription;
pageData.columns = tableColumns;
pageData.tablePermissions = {
read: currentResource.model.readRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
}
),
update: currentResource.model.updateRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
}
),
delete: currentResource.model.deleteRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
}
),
create: currentResource.model.createRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
}
),
};
pageData.listRequest = await LocalCache.getOrSetString(
'model',
'list-request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/ListRequest.md`
);
}
);
pageData.itemRequest = await LocalCache.getOrSetString(
'model',
'item-request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/ItemRequest.md`
);
}
);
pageData.itemResponse = await LocalCache.getOrSetString(
'model',
'item-response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/ItemResponse.md`
);
}
);
pageData.countRequest = await LocalCache.getOrSetString(
'model',
'count-request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/CountRequest.md`
);
}
);
pageData.countResponse = await LocalCache.getOrSetString(
'model',
'count-response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/CountResponse.md`
);
}
);
pageData.updateRequest = await LocalCache.getOrSetString(
'model',
'update-request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/UpdateRequest.md`
);
}
);
pageData.updateResponse = await LocalCache.getOrSetString(
'model',
'update-response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/UpdateResponse.md`
);
}
);
pageData.createRequest = await LocalCache.getOrSetString(
'model',
'create-request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/CreateRequest.md`
);
}
);
pageData.createResponse = await LocalCache.getOrSetString(
'model',
'create-response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/CreateResponse.md`
);
}
);
pageData.deleteRequest = await LocalCache.getOrSetString(
'model',
'delete-request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/DeleteRequest.md`
);
}
);
pageData.deleteResponse = await LocalCache.getOrSetString(
'model',
'delete-response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/DeleteResponse.md`
);
}
);
pageData.listResponse = await LocalCache.getOrSetString(
'model',
'list-response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Model/ListResponse.md`
);
}
);
pageData.exampleObjectID = ObjectID.generate();
pageData.apiPath =
AppApiRoute.toString() +
currentResource.model.crudApiPath?.toString();
pageData.isMasterAdminApiDocs =
currentResource.model.isMasterAdminApiDocs;
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
// Check if page is provided
if (!page) {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
// Get current resource
const currentResource: ModelDocumentation | undefined =
ResourceDictionary[page];
// Check if current resource exists
if (!currentResource) {
return PageNotFoundServiceHandler.executeResponse(req, res);
}
// Set page title and description
pageTitle = currentResource.name;
pageDescription = currentResource.description;
page = "model";
// Get table columns for current resource
const tableColumns: any = getTableColumns(currentResource.model);
// Filter out columns with no access
for (const key in tableColumns) {
const accessControl: ColumnAccessControl | null =
currentResource.model.getColumnAccessControlFor(key);
if (!accessControl) {
delete tableColumns[key];
continue;
}
if (
accessControl?.create.length === 0 &&
accessControl?.read.length === 0 &&
accessControl?.update.length === 0
) {
delete tableColumns[key];
continue;
}
tableColumns[key].permissions = accessControl;
}
// Remove unnecessary columns
delete tableColumns["deletedAt"];
delete tableColumns["deletedByUserId"];
delete tableColumns["deletedByUser"];
delete tableColumns["version"];
// Set page data
pageData.title = currentResource.model.singularName;
pageData.description = currentResource.model.tableDescription;
pageData.columns = tableColumns;
pageData.tablePermissions = {
read: currentResource.model.readRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
},
),
update: currentResource.model.updateRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
},
),
delete: currentResource.model.deleteRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
},
),
create: currentResource.model.createRecordPermissions.map(
(permission: Permission) => {
return PermissionDictionary[permission];
},
),
};
// Cache the list request data
pageData.listRequest = await LocalCache.getOrSetString(
"model",
"list-request",
async () => {
// Read the list request data from a file
return await LocalFile.read(`${CodeExamplesPath}/Model/ListRequest.md`);
},
);
// Cache the item request data
pageData.itemRequest = await LocalCache.getOrSetString(
"model",
"item-request",
async () => {
// Read the item request data from a file
return await LocalFile.read(`${CodeExamplesPath}/Model/ItemRequest.md`);
},
);
// Cache the item response data
pageData.itemResponse = await LocalCache.getOrSetString(
"model",
"item-response",
async () => {
// Read the item response data from a file
return await LocalFile.read(
`${CodeExamplesPath}/Model/ItemResponse.md`,
);
},
);
// Cache the count request data
pageData.countRequest = await LocalCache.getOrSetString(
"model",
"count-request",
async () => {
// Read the count request data from a file
return await LocalFile.read(
`${CodeExamplesPath}/Model/CountRequest.md`,
);
},
);
// Cache the count response data
pageData.countResponse = await LocalCache.getOrSetString(
"model",
"count-response",
async () => {
// Read the CountResponse.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/CountResponse.md`,
);
},
);
pageData.updateRequest = await LocalCache.getOrSetString(
"model",
"update-request",
async () => {
// Read the UpdateRequest.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/UpdateRequest.md`,
);
},
);
pageData.updateResponse = await LocalCache.getOrSetString(
"model",
"update-response",
async () => {
// Read the UpdateResponse.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/UpdateResponse.md`,
);
},
);
pageData.createRequest = await LocalCache.getOrSetString(
"model",
"create-request",
async () => {
// Read the CreateRequest.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/CreateRequest.md`,
);
},
);
pageData.createResponse = await LocalCache.getOrSetString(
"model",
"create-response",
async () => {
// Read the CreateResponse.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/CreateResponse.md`,
);
},
);
pageData.deleteRequest = await LocalCache.getOrSetString(
"model",
"delete-request",
async () => {
// Read the DeleteRequest.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/DeleteRequest.md`,
);
},
);
pageData.deleteResponse = await LocalCache.getOrSetString(
"model",
"delete-response",
async () => {
// Read the DeleteResponse.md file
return await LocalFile.read(
`${CodeExamplesPath}/Model/DeleteResponse.md`,
);
},
);
// Get list response from cache or set it if it's not available
pageData.listResponse = await LocalCache.getOrSetString(
"model",
"list-response",
async () => {
// Read the list response from a file
return await LocalFile.read(
`${CodeExamplesPath}/Model/ListResponse.md`,
);
},
);
// Generate a unique ID for the example object
pageData.exampleObjectID = ObjectID.generate();
// Construct the API path for the current resource
pageData.apiPath =
AppApiRoute.toString() + currentResource.model.crudApiPath?.toString();
// Check if the current resource is a master admin API
pageData.isMasterAdminApiDocs = currentResource.model.isMasterAdminApiDocs;
// Render the index page with the required data
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
}

View File

@@ -1,21 +1,25 @@
import { ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources(); // Get an array of model documentation resources
export default class ServiceHandler {
public static async executeResponse(
_req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
res.status(404);
return res.render(`${ViewsPath}/pages/index`, {
page: '404',
pageTitle: 'Page Not Found',
pageDescription: "Page you're looking for is not found.",
resources: Resources,
pageData: {},
});
}
// This is a static method that handles the response
public static async executeResponse(
_req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
// Set the HTTP status code to 404 (Not Found)
res.status(404);
// Render the 'index' page with the given data
return res.render(`${ViewsPath}/pages/index`, {
page: "404", // The page type (404 in this case)
pageTitle: "Page Not Found", // The page title
pageDescription: "Page you're looking for is not found.", // The page description
resources: Resources, // The array of model documentation resources
pageData: {}, // An empty object to hold any additional page data
});
}
}

View File

@@ -1,50 +1,55 @@
import { CodeExamplesPath, ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import LocalCache from 'CommonServer/Infrastructure/LocalCache';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import LocalFile from 'CommonServer/Utils/LocalFile';
import { CodeExamplesPath, ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import LocalCache from "CommonServer/Infrastructure/LocalCache";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
import LocalFile from "CommonServer/Utils/LocalFile";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources(); // Get all resources from ResourceUtil
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
const page: string | undefined = req.params['page'];
const pageData: any = {};
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
let pageTitle: string = ""; // Initialize page title
let pageDescription: string = ""; // Initialize page description
const page: string | undefined = req.params["page"]; // Get the page parameter from the request
const pageData: any = {}; // Initialize page data object
pageTitle = 'Pagination';
pageDescription = 'Learn how to paginate requests with OneUptime API';
// Set page title and description
pageTitle = "Pagination";
pageDescription = "Learn how to paginate requests with OneUptime API";
pageData.responseCode = await LocalCache.getOrSetString(
'pagination',
'response',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Pagination/Response.md`
);
}
// Get response and request code from LocalCache or LocalFile
pageData.responseCode = await LocalCache.getOrSetString(
"pagination",
"response",
async () => {
// Read Response.md file from CodeExamplesPath
return await LocalFile.read(
`${CodeExamplesPath}/Pagination/Response.md`,
);
},
);
pageData.requestCode = await LocalCache.getOrSetString(
'pagination',
'request',
async () => {
return await LocalFile.read(
`${CodeExamplesPath}/Pagination/Request.md`
);
}
pageData.requestCode = await LocalCache.getOrSetString(
"pagination",
"request",
async () => {
// Read Request.md file from CodeExamplesPath
return await LocalFile.read(
`${CodeExamplesPath}/Pagination/Request.md`,
);
},
);
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
// Render the page with the page data
return res.render(`${ViewsPath}/pages/index`, {
page: page, // Pass the page parameter
resources: Resources, // Pass all resources
pageTitle: pageTitle, // Pass the page title
pageDescription: pageDescription, // Pass the page description
pageData: pageData, // Pass the page data
});
}
}

View File

@@ -1,35 +1,41 @@
import { ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import { PermissionHelper, PermissionProps } from 'Common/Types/Permission';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import { PermissionHelper, PermissionProps } from "Common/Types/Permission";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
export default class ServiceHandler {
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
let pageTitle: string = '';
let pageDescription: string = '';
const page: string | undefined = req.params['page'];
const pageData: any = {};
public static async executeResponse(
req: ExpressRequest,
res: ExpressResponse,
): Promise<void> {
// Initialize page title and description
let pageTitle: string = "";
let pageDescription: string = "";
pageTitle = 'Permissions';
pageDescription = 'Learn how permissions work with OneUptime';
// Get the requested page
const page: string | undefined = req.params["page"];
const pageData: any = {};
pageData.permissions = PermissionHelper.getAllPermissionProps().filter(
(i: PermissionProps) => {
return i.isAssignableToTenant;
}
);
// Set page title and description
pageTitle = "Permissions";
pageDescription = "Learn how permissions work with OneUptime";
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
// Filter permissions to only include those assignable to tenants
pageData.permissions = PermissionHelper.getAllPermissionProps().filter(
(i: PermissionProps) => {
return i.isAssignableToTenant;
},
);
// Render the page
return res.render(`${ViewsPath}/pages/index`, {
page: page,
resources: Resources,
pageTitle: pageTitle,
pageDescription: pageDescription,
pageData: pageData,
});
}
}

View File

@@ -1,21 +1,23 @@
import { ViewsPath } from '../Utils/Config';
import ResourceUtil, { ModelDocumentation } from '../Utils/Resources';
import { ExpressRequest, ExpressResponse } from 'CommonServer/Utils/Express';
import { ViewsPath } from "../Utils/Config";
import ResourceUtil, { ModelDocumentation } from "../Utils/Resources";
import { ExpressRequest, ExpressResponse } from "CommonServer/Utils/Express";
const Resources: Array<ModelDocumentation> = ResourceUtil.getResources();
const resources: Array<ModelDocumentation> = ResourceUtil.getResources(); // Get resources from ResourceUtil
export default class ServiceHandler {
public static async executeResponse(
_req: ExpressRequest,
res: ExpressResponse
): Promise<void> {
res.status(200);
return res.render(`${ViewsPath}/pages/index`, {
page: 'status',
pageTitle: 'Status',
pageDescription: '200 - Success',
resources: Resources,
pageData: {},
});
}
public static async executeResponse(
_req: ExpressRequest, // Ignore request object
res: ExpressResponse,
): Promise<void> {
// Set HTTP status to 200
res.status(200);
return res.render(`${ViewsPath}/pages/index`, {
// Render index page with necessary data
page: "status",
pageTitle: "Status",
pageDescription: "200 - Success",
resources: resources, // Pass resources to the template
pageData: {}, // Pass empty data to the template
});
}
}

View File

@@ -1,4 +1,4 @@
export const ViewsPath: string = '/usr/src/app/FeatureSet/ApiReference/views';
export const StaticPath: string = '/usr/src/app/FeatureSet/ApiReference/Static';
export const ViewsPath: string = "/usr/src/app/FeatureSet/ApiReference/views";
export const StaticPath: string = "/usr/src/app/FeatureSet/ApiReference/Static";
export const CodeExamplesPath: string =
'/usr/src/app/FeatureSet/ApiReference/CodeExamples';
"/usr/src/app/FeatureSet/ApiReference/CodeExamples";

View File

@@ -1,74 +1,77 @@
import BaseModel from 'Common/Models/BaseModel';
import ArrayUtil from 'Common/Types/ArrayUtil';
import Dictionary from 'Common/Types/Dictionary';
import { IsBillingEnabled } from 'CommonServer/EnvironmentConfig';
import Models from 'Model/Models/Index';
import BaseModel from "Common/Models/BaseModel";
import ArrayUtil from "Common/Types/ArrayUtil";
import Dictionary from "Common/Types/Dictionary";
import { IsBillingEnabled } from "CommonServer/EnvironmentConfig";
import Models from "Model/Models/Index";
export interface ModelDocumentation {
name: string;
path: string;
model: BaseModel;
description: string;
name: string;
path: string;
model: BaseModel;
description: string;
}
export default class ResourceUtil {
public static getResources(): Array<ModelDocumentation> {
const resources: Array<ModelDocumentation> = Models.filter(
(model: typeof BaseModel) => {
const modelInstance: BaseModel = new model();
let showDocs: boolean = modelInstance.enableDocumentation;
// Get all resources that should have documentation enabled
public static getResources(): Array<ModelDocumentation> {
const resources: Array<ModelDocumentation> = Models.filter(
(model: typeof BaseModel) => {
const modelInstance: BaseModel = new model();
let showDocs: boolean = modelInstance.enableDocumentation;
if (modelInstance.isMasterAdminApiDocs && IsBillingEnabled) {
showDocs = false;
}
return showDocs;
}
)
.map((model: typeof BaseModel) => {
const modelInstance: BaseModel = new model();
return {
name: modelInstance.singularName!,
path: modelInstance.getAPIDocumentationPath(),
model: modelInstance,
description: modelInstance.tableDescription!,
};
})
.sort(ArrayUtil.sortByFieldName('name'));
return resources;
}
public static getFeaturedResources(): Array<ModelDocumentation> {
const featuredResources: Array<string> = [
'Monitor',
'Scheduled Maintenance Event',
'Status Page',
'Incident',
'Team',
'On-Call Duty',
'Label',
'Team Member',
];
return ResourceUtil.getResources().filter(
(resource: ModelDocumentation) => {
return featuredResources.includes(resource.name);
}
);
}
public static getResourceDictionaryByPath(): Dictionary<ModelDocumentation> {
const dict: Dictionary<ModelDocumentation> = {};
const resources: Array<ModelDocumentation> =
ResourceUtil.getResources();
for (const resource of resources) {
dict[resource.path] = resource;
// If billing is enabled, do not show master admin API docs
if (modelInstance.isMasterAdminApiDocs && IsBillingEnabled) {
showDocs = false;
}
return dict;
return showDocs;
},
)
.map((model: typeof BaseModel) => {
const modelInstance: BaseModel = new model();
return {
name: modelInstance.singularName!,
path: modelInstance.getAPIDocumentationPath(),
model: modelInstance,
description: modelInstance.tableDescription!,
};
})
.sort(ArrayUtil.sortByFieldName("name"));
return resources;
}
// Get featured resources that are pre-selected
public static getFeaturedResources(): Array<ModelDocumentation> {
const featuredResources: Array<string> = [
"Monitor",
"Scheduled Maintenance Event",
"Status Page",
"Incident",
"Team",
"On-Call Duty",
"Label",
"Team Member",
];
return ResourceUtil.getResources().filter(
(resource: ModelDocumentation) => {
return featuredResources.includes(resource.name);
},
);
}
// Create a dictionary of resources indexed by their path
public static getResourceDictionaryByPath(): Dictionary<ModelDocumentation> {
const dict: Dictionary<ModelDocumentation> = {};
const resources: Array<ModelDocumentation> = ResourceUtil.getResources();
for (const resource of resources) {
dict[resource.path] = resource;
}
return dict;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,7 @@
applyStylesTo("h3", "mb-5 scroll-mt-24 mt-10 font-bold text-base")
applyStylesTo("p", "mb-5")
applyStylesTo("link", "text-emerald-500 hover:text-emerald-600")
applyStylesTo("model-inline-code", "rounded p-0.5 px-1 text-sm text-gray-50 bg-gray-600 border-2 border-gray-600 shadow")
applyStylesTo("inline-code", "rounded p-0.5 px-1 text-sm text-gray-500 bg-gray-100 border-2 border-gray-200")
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,67 @@
## Deploy LLM Server
This step is optional. You need to deploy LLM Server only if you want to use Copilot with LLM Server on your infrastructure for data privacy reasons. If you are comfortable with OpenAI's privacy policy, you can skip this step and use OpenAI directly.
### Pre-requisites
Before you deploy LLM Server, you need to make sure you have the following:
- **Docker**: You need to have Docker installed on your machine.
- **Docker Compose**: You need to have Docker Compose installed on your machine.
- **System Requirements**: You need to have at least 64 GB of RAM, 32 GB GPU (compitable with CUDA & Docker), 8 CPU cores, and 100 GB of disk space. You could get away with less resources, but we recommend the above configuration for optimal performance.
- **GPU is accessible by Docker**: You need to make sure that the GPU is accessible by Docker. Please read this [guide](https://docs.docker.com/compose/gpu-support/) for more information.
### Environment Variables
You need to set the following environment variables in the `docker-compose.yml` file:
- `HF_TOKEN`: This is the Hugging Face API token. You can get this token by signing up on Hugging Face and creating a new API token.
- `HF_MODEL_NAME` (optional): This is the model name from Hugging Face. You can get this model name from the Hugging Face model hub. If you do not set this, we will use `meta-llama/Meta-Llama-3-8B-Instruct` as the default model.
### Installation
To deploy LLM Server, you need to follow the following steps with docker-compose:
Create a `docker-compose.yml` file with the following content:
```yaml
llm:
extends:
file: ./docker-compose.base.yml
service: llm
ports:
- '8547:8547'
image: 'oneuptime/llm:release'
environment:
- HF_TOKEN=<TOKEN_FROM_HUGGINGFACE>
- HF_MODEL_NAME=<MODEL_NAME_FROM_HUGGING_FACE>
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
```
Run the following command to start the LLM Server:
```bash
docker-compose up -d
```
You can now access the LLM Server at `http://localhost:8547`.
### TLS/SSL Configuration
You can set up TLS/SSL by having a reverse proxy in front of the LLM Server. This is recommended for production deployments and is beyond the scope of this document.
### Public Access
Please make sure this server is publicly accessible. So, it can be accessed by Copilot.
### Security
Please also make sure to secure the server by setting up a firewall so only copilot can access it.

View File

@@ -0,0 +1,140 @@
## OneUptime Copilot
OneUptime Copilot is a tool that helps you improve your codebase automatically. Copilot can fix following issues automatically:
- **Performance Issues**: Improve database queries, optimize code, reduce memory usage, decrease API response time, etc.
- **Security Issues**: Fix security vulnerabilities, prevent SQL injection, XSS, CSRF, etc.
- **Code Quality Issues**: Improve code readability, maintainability, and scalability. Improve comments, naming conventions, refactor code, etc.
- **Error Handling Issues**: Improve error handling, exception handling, logging, etc.
- **Testing Issues**: Improve test coverage, test quality, test performance, etc.
- **Documentation Issues**: Improve documentation quality, comments, README, etc.
### Architecture
Copilot can be installed as a CI/CD tool and can be run on every merge to master / main branch. Copilot can also be scheduled to run as a cron on the CI/CD pipeline. We recommend you run Copilot atleast once/day.
There are three services when running copilot:
- **OneUptime**: You need to deploy or use OneUptime Cloud (https://oneuptime.com) to run Copilot. When you deploy OneUptime, url should be publicily accessible.
- **Copilot**: Copilot is the main service that runs the Copilot engine. Copilot engine is responsible for analyzing the codebase and fixing issues.
- **LLM Server** (Optional): Copilot sends your code to LLM Server to analyze and fix issues. The source-code and docker-image is [open-source](https://github.com/OneUptime/oneuptime/tree/master/LLM) and can be found at [Docker Hub](https://hub.docker.com/r/oneuptime/llm). This can be self-deployed if you want to run Copilot on-premises or you can use the hosted version.
### FAQ
**Is my code sent to OneUptime?**
No, your code is not sent to OneUptime. Copilot runs on your CI/CD pipeline and sends the code to LLM Server for analysis. LLM Server can be self-hosted.
**Is my code sent to Self-Hosted LLM Server?**
Yes, but you can self host LLM server so code is not sent outside of your infrastructure. Your code is sent to LLM Server for analysis. LLM Server is responsible for analyzing the code and fixing issues.
**Is my code sent to any third-party?**
No. We strictly do not send any telemetry data or code to any third-party.
**Is my code sent to OpenAI?**
No, If you host LLM Server yourself.
Yes, if you choose to use OpenAI by setting `OPENAI_API_KEY`. We recommend you to use OpenAI only if you are comfortable with OpenAI's privacy policy. We're not responsible for any data sent to OpenAI or how your code is analyzed / used by OpenAI.
### Pre-requisites
Before you install Copilot, you need to make sure you have the following:
- **OneUptime Account**: You need to have a OneUptime account to use Copilot. You can sign up for a free account at [OneUptime](https://oneuptime.com). You can either use OneUptime Cloud or deploy OneUptime on your infrastructure.
- **GitHub Account**: You need to have a GitHub account to use Copilot. You can sign up for a free account at [GitHub](https://github.com). You can also use GitLab, Bitbucket, etc.
You also need either of the following:
- **LLM Server** (Optional): You need to have LLM Server to run Copilot. [Please check this guide to deploy LLM Server](https://oneuptime.com/docs/copilot/deploy-llm-server).
or
- **OpenAI** (Optional): You need to have OpenAI API Key and Model to run Copilot. Please check env vars for more information.
### Installation
To install Copilot, you need to follow the following steps:
#### Environment Variables
You need to set the following environment variables to run Copilot:
**Required Environment Variables**:
- **ONEUPTIME_REPOSITORY_SECRET_KEY**: The secret key of the repository. You can get this key from OneUptime Dashboard -> Reliability Copilot -> View Repository. If you don't have a repository, you can create a new repository, then click on "View Repository" to get the secret key.
- **CODE_REPOSITORY_USERNAME**: OneUptime uses this username to commit and push changes to GitHub / GitLab / etc. This should be the username of the existing user on GitHub that has access to the repository.
- **CODE_REPOSITORY_PASSWORD**: OneUptime uses this password to commit and push changes to GitHub / GitLab / etc. This should be the password of the existing user on GitHub that has access to the repository. You can also use Personal Access Tokens instead of Password. Please make sure the token has write permissions to the repo.
**Optional Environment Variables**:
- **ONEUPTIME_URL**: The URL of OneUptime Cloud. If left empty, Copilot will default to `https://oneuptime.com`.
If you are using LLM Server, you need to set the following environment variables:
- **ONEUPTIME_LLM_SERVER_URL**: The URL of LLM Server. (For example: https://your-llm-server.com:8547)
If you are using OpenAI, you need to set the following environment variables:
- **OPENAI_API_KEY**: The API key of OpenAI. You can get this key from OpenAI Dashboard.
**Important**: You need to provide either `ONEUPTIME_LLM_SERVER_URL` or `OPENAI_API_KEY` in order to use Copilot.
#### GitHub Actions
You can use GitHub Actions to run Copilot on every merge to master / main branch.
```yaml
name: "OneUptime Reliability Copilot"
on:
push:
# change this to main if you are using main branch.
branches: [ master ]
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'
jobs:
analyze:
name: Analyze Code
runs-on: ubuntu-latest
steps:
# Run Reliability Copilot in Doker Container
- name: Run Copilot
run: |
docker run --rm \
-e CODE_REPOSITORY_PASSWORD='<YOUR_GITHUB_PASSWORD>' \ # Required. Please make sure to use GitHub secrets.
-e CODE_REPOSITORY_USERNAME='<YOUR_GITHUB_USERNAME>' \ # Required.
-e ONEUPTIME_URL='https://oneuptime.com' \ # Optional. Leave empty to use OneUptime Cloud.
-e ONEUPTIME_REPOSITORY_SECRET_KEY='<ONEUPTIME_REPOSITORY_SECRET_KEY>' \ # Required. Please make sure to use GitHub secrets.
-e ONEUPTIME_LLM_SERVER_URL='<YOUR_ONEUPTIME_LLM_SERVER>' \ # Optional. Leave empty to use OneUptime LLM Server.
-e OPENAI_API_KEY='<YOUR_OPENAI_API_KEY>' \ # Optional. Leave empty to not use OpenAI.
--net=host oneuptime/copilot:release
```
#### Docker
You can also run Copilot using docker. You can run this in any CI/CD of your choice.
```bash
docker run --rm \
-e CODE_REPOSITORY_PASSWORD='<YOUR_GITHUB_PASSWORD>' \ # Required. Please make sure to use GitHub secrets.
-e CODE_REPOSITORY_USERNAME='<YOUR_GITHUB_USERNAME>' \ # Required.
-e ONEUPTIME_URL='https://oneuptime.com' \ # Optional. Leave empty to use OneUptime Cloud.
-e ONEUPTIME_REPOSITORY_SECRET_KEY='<ONEUPTIME_REPOSITORY_SECRET_KEY>' \ # Required. Please make sure to use GitHub secrets.
-e ONEUPTIME_LLM_SERVER_URL='<YOUR_ONEUPTIME_LLM_SERVER>' \ # Optional. Leave empty to use OneUptime LLM Server.
-e OPENAI_API_KEY='<YOUR_OPENAI_API_KEY>' \ # Optional. Leave empty to not use OpenAI.
--net=host oneuptime/copilot:release
```
### Support
If you have any questions or need help, please contact us at support@oneuptime.com

View File

@@ -56,6 +56,37 @@ If you don't like to use npm or do not have it installed, run this instead:
sudo bash -c "(export $(grep -v '^#' config.env | xargs) && docker compose up --remove-orphans -d)"
```
### Accessing OneUptime
OneUptime should run at: http://localhost. You need to register a new account for your instance to start using it.
### Setting up TLS/SSL Certificates
OneUptime **does not** support setting up SSL/TLS certificates. You need to set up SSL/TLS certificates on your own.
If you need to use SSL/TLS certificates, follow these steps:
1. Use a reverse proxy like Nginx or Caddy.
2. Use Let's Encrypt to provision the certificates.
3. Point the reverse proxy to the OneUptime server.
4. Update the following settings:
- Set `HTTP_PROTOCOL` env var to `https`.
- Change `HOST` env var to the domain name of the server where the reverse proxy is hosted.
## Production Readiness Checklist
Ideally do not deploy OneUptime in production with docker-compose. We highly recommend using Kubernetes. There's a helm chart available for OneUptime [here](https://artifacthub.io/packages/helm/oneuptime/oneuptime).
If you still want to deploy OneUptime in production with docker-compose, please consider the following:
- **SSL/TLS**: Set up SSL/TLS certificates. OneUptime does not support setting up SSL/TLS certificates. You need to set up SSL/TLS certificates on your own. Please see above.
- **Secrets**: Make sure you have random secrets in your `config.env` file. There are some default secrets in that file. Please replace them with random long strings.
- **Backups**: Regularly backup your databases (Clickhouse, Postgres). Redis is used as a cache and is stateless and can be safely ignored.
- **Updates**: Please regularly update OneUptime. We release updates every day. We recommend you to update the software aleast once a week if you're running in production.
### Updating OneUptime
To update:
```
@@ -64,9 +95,6 @@ git pull
npm run update
```
### Things to consider
- In our Docker setup, we employ a local logging driver. OneUptime, particularly within the probe and ingestor containers, generates a substantial amount of logs. To prevent your storage from becoming full, it's crucial to limit the logging storage in Docker. For detailed instructions on how to do this, please refer to the official Docker documentation [here](https://docs.docker.com/config/containers/logging/local/).
OneUptime should run at: http://localhost. You need to register a new account for your instance to start using it. If you would like to use https, please use a reverse proxy like Nginx.
- In our Docker setup, we employ a local logging driver. OneUptime, particularly within the probe and ingestor containers, generates a substantial amount of logs. To prevent your storage from becoming full, it's crucial to limit the logging storage in Docker. For detailed instructions on how to do this, please refer to the official Docker documentation [here](https://docs.docker.com/config/containers/logging/local/).

View File

@@ -43,7 +43,7 @@ Measure and optimize the performance of your online apps and services. Track key
Detect and diagnose errors in your online services. Get detailed error reports with stack traces, context, and user feedback. Replace tools like Sentry.
##### Reliability Autopilot
##### Reliability Copilot
Scan your code and fix performance issues and errors automatically. Get recommendations for improving the reliability of your online services.

View File

@@ -1,21 +1,86 @@
## Setting up Custom Probes
You can set up custom probes inside your network to monitor resources in your private network or resources that are behind your firewall.
You can set up custom probes inside your network to monitor resources in your private network or resources that are behind your firewall.
To begin with you need to create a custom probe in your Project Settings > Probe. Once you have created the custom probe on your OneUptime Dashboard. You should have the `PROBE_ID` and `PROBE_KEY`
### Deploy Probe
### Run the probe
#### Docker
To run a probe, please make sure you have docker installed. You can run custom probe by:
To run a probe, please make sure you have docker installed. You can run custom probe by:
```
docker run --name oneuptime-probe --network host -e PROBE_KEY=<probe-key> -e PROBE_ID=<probe-id> -e ONEUPTIME_URL=https://oneuptime.com -d oneuptime/probe:release
```
If you are self hosting OneUptime, you can change `INGESTOR_URL` to your custom self hosted instance.
If you are self hosting OneUptime, you can change `ONEUPTIME_URL` to your custom self hosted instance.
### Verify
#### Docker Compose
You can also run the probe using docker-compose. Create a `docker-compose.yml` file with the following content:
```yaml
version: "3"
services:
oneuptime-probe:
image: oneuptime/probe:release
container_name: oneuptime-probe
environment:
- PROBE_KEY=<probe-key>
- PROBE_ID=<probe-id>
- ONEUPTIME_URL=https://oneuptime.com
network_mode: host
restart: always
```
Then run the following command:
```
docker-compose up -d
```
If you are self hosting OneUptime, you can change `ONEUPTIME_URL` to your custom self hosted instance.
#### Kubernetes
You can also run the probe using Kubernetes. Create a `oneuptime-probe.yaml` file with the following content:
```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: oneuptime-probe
spec:
selector:
matchLabels:
app: oneuptime-probe
template:
metadata:
labels:
app: oneuptime-probe
spec:
containers:
image: oneuptime/probe:release
env:
- name: PROBE_KEY
value: "<probe-key>"
- name: PROBE_ID
value: "<probe-id>"
- name: ONEUPTIME_URL
value: "https://oneuptime.com"
```
Then run the following command:
```bash
kubectl apply -f oneuptime-probe.yaml
```
If you are self hosting OneUptime, you can change `ONEUPTIME_URL` to your custom self hosted instance.
### Verify
If the probe is running successfully. It should show as `Connected` on your OneUptime dashboard. If it does not show as connected. You need to check logs of the container. If you're still having trouble. Please create an issue on [GitHub](https://github.com/oneuptime/oneuptime) or [contact support](https://oneuptime.com/support)

View File

@@ -29,7 +29,6 @@ We use OpenTelemetry to collect application logs. OneUptime currently supports l
- [JavaScript / Typescript / NodeJS / Browser](https://opentelemetry.io/docs/instrumentation/js/)
- [Python](https://opentelemetry.io/docs/instrumentation/python/)
- [Ruby](https://opentelemetry.io/docs/instrumentation/ruby/)
- [Swift](https://opentelemetry.io/docs/instrumentation/swift/)
- [PHP](https://opentelemetry.io/docs/instrumentation/php/)
- [Erlang](https://opentelemetry.io/docs/instrumentation/erlang/)
- [Rust](https://opentelemetry.io/docs/instrumentation/rust/)

View File

@@ -1,93 +1,107 @@
import { ContentPath, StaticPath, ViewsPath } from './Utils/Config';
import DocsNav, { NavGroup, NavLink } from './Utils/Nav';
import DocsRender from './Utils/Render';
import FeatureSet from 'CommonServer/Types/FeatureSet';
import { ContentPath, StaticPath, ViewsPath } from "./Utils/Config";
import DocsNav, { NavGroup, NavLink } from "./Utils/Nav";
import DocsRender from "./Utils/Render";
import FeatureSet from "CommonServer/Types/FeatureSet";
import Express, {
ExpressApplication,
ExpressRequest,
ExpressResponse,
ExpressStatic,
} from 'CommonServer/Utils/Express';
import LocalFile from 'CommonServer/Utils/LocalFile';
import logger from 'CommonServer/Utils/Logger';
import 'ejs';
ExpressApplication,
ExpressRequest,
ExpressResponse,
ExpressStatic,
} from "CommonServer/Utils/Express";
import Response from "CommonServer/Utils/Response";
import LocalFile from "CommonServer/Utils/LocalFile";
import logger from "CommonServer/Utils/Logger";
import "ejs";
const DocsFeatureSet: FeatureSet = {
init: async (): Promise<void> => {
const app: ExpressApplication = Express.getExpressApp();
init: async (): Promise<void> => {
const app: ExpressApplication = Express.getExpressApp();
app.get('/docs', (_req: ExpressRequest, res: ExpressResponse) => {
res.redirect('/docs/introduction/getting-started');
});
app.get("/docs", (_req: ExpressRequest, res: ExpressResponse) => {
res.redirect("/docs/introduction/getting-started");
});
app.get(
'/docs/:categorypath/:pagepath',
async (_req: ExpressRequest, res: ExpressResponse) => {
try {
const fullPath: string =
`${_req.params['categorypath']}/${_req.params['pagepath']}`.toLowerCase();
app.get(
"/docs/as-markdown/:categorypath/:pagepath",
async (req: ExpressRequest, res: ExpressResponse) => {
try {
const fullPath: string =
`${req.params["categorypath"]}/${req.params["pagepath"]}`.toLowerCase();
// read file from Content folder.
let contentInMarkdown: string = await LocalFile.read(
`${ContentPath}/${fullPath}.md`
);
// read file from Content folder.
const contentInMarkdown: string = await LocalFile.read(
`${ContentPath}/${fullPath}.md`,
);
// remove first line from content because we dont want to show title in content. Title is already in nav.
return Response.sendMarkdownResponse(req, res, contentInMarkdown);
} catch (err) {
logger.error(err);
res.status(500);
return res.send("Internal Server Error");
}
},
);
contentInMarkdown = contentInMarkdown
.split('\n')
.slice(1)
.join('\n');
app.get(
"/docs/:categorypath/:pagepath",
async (_req: ExpressRequest, res: ExpressResponse) => {
try {
const fullPath: string =
`${_req.params["categorypath"]}/${_req.params["pagepath"]}`.toLowerCase();
const renderedContent: string = await DocsRender.render(
contentInMarkdown
);
// read file from Content folder.
let contentInMarkdown: string = await LocalFile.read(
`${ContentPath}/${fullPath}.md`,
);
const currentCategory: NavGroup | undefined = DocsNav.find(
(category: NavGroup) => {
return category.links.find((link: NavLink) => {
return link.url
.toLocaleLowerCase()
.includes(fullPath);
});
}
);
// remove first line from content because we dont want to show title in content. Title is already in nav.
const currrentNavLink: NavLink | undefined =
currentCategory?.links.find((link: NavLink) => {
return link.url
.toLocaleLowerCase()
.includes(fullPath);
});
contentInMarkdown = contentInMarkdown.split("\n").slice(1).join("\n");
if (!currentCategory || !currrentNavLink) {
// render not found.
const renderedContent: string =
await DocsRender.render(contentInMarkdown);
res.status(404);
return res.render(`${ViewsPath}/NotFound`, {
nav: DocsNav,
});
}
const currentCategory: NavGroup | undefined = DocsNav.find(
(category: NavGroup) => {
return category.links.find((link: NavLink) => {
return link.url.toLocaleLowerCase().includes(fullPath);
});
},
);
res.render(`${ViewsPath}/Index`, {
nav: DocsNav,
content: renderedContent,
category: currentCategory,
link: currrentNavLink,
githubPath: fullPath,
});
} catch (err) {
logger.error(err);
res.status(500);
return res.render(`${ViewsPath}/ServerError`, {
nav: DocsNav,
});
}
}
);
const currrentNavLink: NavLink | undefined =
currentCategory?.links.find((link: NavLink) => {
return link.url.toLocaleLowerCase().includes(fullPath);
});
app.use('/docs/static', ExpressStatic(StaticPath));
},
if (!currentCategory || !currrentNavLink) {
// render not found.
res.status(404);
return res.render(`${ViewsPath}/NotFound`, {
nav: DocsNav,
});
}
res.render(`${ViewsPath}/Index`, {
nav: DocsNav,
content: renderedContent,
category: currentCategory,
link: currrentNavLink,
githubPath: fullPath,
});
} catch (err) {
logger.error(err);
res.status(500);
return res.render(`${ViewsPath}/ServerError`, {
nav: DocsNav,
});
}
},
);
app.use("/docs/static", ExpressStatic(StaticPath));
},
};
export default DocsFeatureSet;

View File

@@ -8,8 +8,20 @@ usage() {
exit 1
}
# if there's no $HOME env var then set it to /usr
if [ -z "$HOME" ]; then
HOME=/usr
fi
# Default parameters
BINDIR=/usr/bin
BINDIR=$HOME/bin
# Make sure bindir exists
if [ ! -d "$BINDIR" ]; then
mkdir -p "$BINDIR"
fi
DEBUG=0
# Parse command-line options
@@ -41,6 +53,9 @@ case $ARCH in
aarch64)
ARCH=arm64
;;
*arm64*)
ARCH=arm64
;;
*arm*)
ARCH=arm
;;
@@ -65,8 +80,32 @@ echo "Fetching the latest release: $TAG"
# Construct the URL for the binary release
URL="https://github.com/${REPO}/releases/download/${TAG}/oneuptime-infrastructure-agent_${OS}_${ARCH}.tar.gz"
# Check if wget is installed otherwise install it, do it for all os'es
if ! command -v wget > /dev/null; then
if [ "$OS" = "darwin" ]; then
brew install wget
fi
if [ "$OS" = "linux" ]; then
apt-get install wget
fi
if [ "$OS" = "freebsd" ]; then
pkg install wget
fi
if [ "$OS" = "openbsd" ]; then
pkg_add wget
fi
fi
# Download and extract the binary
curl -sL "${URL}" | tar xz -C "${BINDIR}"
wget "${URL}"
# if darwin
tar -xvzf "oneuptime-infrastructure-agent_${OS}_${ARCH}.tar.gz" -C "${BINDIR}"
# delete the downlaoded file
rm "oneuptime-infrastructure-agent_${OS}_${ARCH}.tar.gz"
# Check if the binary is executable
if [ ! -x "${BINDIR}/oneuptime-infrastructure-agent" ]; then
@@ -74,4 +113,49 @@ if [ ! -x "${BINDIR}/oneuptime-infrastructure-agent" ]; then
exit 1
fi
echo "oneuptime-infrastructure-agent installed successfully to ${BINDIR}. Please configure the agent using 'oneuptime-infrastructure-agent configure'."
# Now add binary to path
if [ -f "$HOME/.bashrc" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.bashrc
source $HOME/.bashrc
fi
if [ -f "$HOME/.bash_profile" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.bash_profile
source $HOME/.bash_profile
fi
if [ -f "$HOME/.zshrc" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.zshrc
source $HOME/.zshrc
fi
if [ -f "$HOME/.profile" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.profile
source $HOME/.profile
fi
if [ -f "$HOME/.bash_login" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.bash_login
source $HOME/.bash_login
fi
if [ -f "$HOME/.bash_logout" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.bash_logout
source $HOME/.bash_logout
fi
if [ -f "$HOME/.bash_aliases" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.bash_aliases
source $HOME/.bash_aliases
fi
if [ -f "$HOME/.bashrc" ]; then
echo "export PATH=$PATH:$BINDIR" >> $HOME/.bashrc
source $HOME/.bashrc
fi
echo "oneuptime-infrastructure-agent has been installed to ${BINDIR}"
echo "oneuptime-infrastructure-agent installed successfully to ${BINDIR}. Please configure the agent using 'oneuptime-infrastructure-agent configure'."
echo "Please reload your shell or open a new shell session to use the oneuptime-infrastructure-agent command."

View File

@@ -1,3 +1,3 @@
export const ViewsPath: string = '/usr/src/app/FeatureSet/Docs/Views';
export const StaticPath: string = '/usr/src/app/FeatureSet/Docs/Static';
export const ContentPath: string = '/usr/src/app/FeatureSet/Docs/Content';
export const ViewsPath: string = "/usr/src/app/FeatureSet/Docs/Views";
export const StaticPath: string = "/usr/src/app/FeatureSet/Docs/Static";
export const ContentPath: string = "/usr/src/app/FeatureSet/Docs/Content";

View File

@@ -1,75 +1,85 @@
export interface NavLink {
title: string;
url: string;
title: string;
url: string;
}
// Define an interface for a navigation group
export interface NavGroup {
title: string;
links: NavLink[];
title: string;
links: NavLink[];
}
// Define an array of navigation groups
const DocsNav: NavGroup[] = [
{
title: 'Introduction',
links: [
{
title: 'Getting Started',
url: '/docs/introduction/getting-started',
},
],
},
{
title: 'Installation',
links: [
{
title: 'Local Development',
url: '/docs/installation/local-development',
},
{
title: 'Docker Compose',
url: '/docs/installation/docker-compose',
},
{
title: 'Kubernetes and Helm',
url: 'https://artifacthub.io/packages/helm/oneuptime/oneuptime',
},
],
},
{
title: 'Monitor',
links: [
{
title: 'Custom Code Monitor',
url: '/docs/monitor/custom-code-monitor',
},
{
title: 'Synthetic Monitor',
url: '/docs/monitor/synthetic-monitor',
},
{
title: 'JavaScript Expressions',
url: '/docs/monitor/javascript-expression',
},
{
title: 'Monitor Secrets',
url: '/docs/monitor/monitor-secrets',
},
],
},
{
title: 'Probe',
links: [
{ title: 'Custom Probes', url: '/docs/probe/custom-probe' },
{ title: 'IP Addresses', url: '/docs/probe/ip-address' },
],
},
{
title: 'Telemetry',
links: [
{ title: 'OpenTelemetry', url: '/docs/telemetry/open-telemetry' },
{ title: 'Fluentd', url: '/docs/telemetry/fluentd' },
],
},
{
title: "Introduction",
links: [
{
title: "Getting Started",
url: "/docs/introduction/getting-started",
},
],
},
{
title: "Installation",
links: [
{
title: "Local Development",
url: "/docs/installation/local-development",
},
{
title: "Docker Compose",
url: "/docs/installation/docker-compose",
},
{
title: "Kubernetes and Helm",
url: "https://artifacthub.io/packages/helm/oneuptime/oneuptime",
},
],
},
{
title: "Monitor",
links: [
{
title: "Custom Code Monitor",
url: "/docs/monitor/custom-code-monitor",
},
{
title: "Synthetic Monitor",
url: "/docs/monitor/synthetic-monitor",
},
{
title: "JavaScript Expressions",
url: "/docs/monitor/javascript-expression",
},
{
title: "Monitor Secrets",
url: "/docs/monitor/monitor-secrets",
},
],
},
{
title: "Probe",
links: [
{ title: "Custom Probes", url: "/docs/probe/custom-probe" },
{ title: "IP Addresses", url: "/docs/probe/ip-address" },
],
},
{
title: "Telemetry",
links: [
{ title: "OpenTelemetry", url: "/docs/telemetry/open-telemetry" },
{ title: "Fluentd", url: "/docs/telemetry/fluentd" },
],
},
{
title: "Copilot",
links: [
{ title: "Installation", url: "/docs/copilot/introduction" },
{ title: "Deploy LLM Server", url: "/docs/copilot/deploy-llm-server" },
],
},
];
// Export the array of navigation groups
export default DocsNav;

View File

@@ -1,10 +1,10 @@
import Markdown, { MarkdownContentType } from 'CommonServer/Types/Markdown';
import Markdown, { MarkdownContentType } from "CommonServer/Types/Markdown";
// This class is responsible for rendering markdown content to HTML
export default class DocsRender {
public static async render(markdownContent: string): Promise<string> {
return Markdown.convertToHTML(
markdownContent,
MarkdownContentType.Docs
);
}
// Render markdown content to HTML and return the result as a promise
public static async render(markdownContent: string): Promise<string> {
// Use the Markdown library to convert markdown content to HTML
return Markdown.convertToHTML(markdownContent, MarkdownContentType.Docs);
}
}

View File

@@ -1,89 +1,88 @@
import BlogPostUtil, { BlogPost, BlogPostHeader } from '../Utils/BlogPost';
import { ViewsPath } from '../Utils/Config';
import NotFoundUtil from '../Utils/NotFound';
import ServerErrorUtil from '../Utils/ServerError';
import Text from 'Common/Types/Text';
import BlogPostUtil, { BlogPost, BlogPostHeader } from "../Utils/BlogPost";
import { ViewsPath } from "../Utils/Config";
import NotFoundUtil from "../Utils/NotFound";
import ServerErrorUtil from "../Utils/ServerError";
import Text from "Common/Types/Text";
import Express, {
ExpressApplication,
ExpressRequest,
ExpressResponse,
} from 'CommonServer/Utils/Express';
import logger from 'CommonServer/Utils/Logger';
ExpressApplication,
ExpressRequest,
ExpressResponse,
} from "CommonServer/Utils/Express";
import logger from "CommonServer/Utils/Logger";
const app: ExpressApplication = Express.getExpressApp();
app.get(
'/blog/post/:file',
async (req: ExpressRequest, res: ExpressResponse) => {
try {
const fileName: string = req.params['file'] as string;
"/blog/post/:file",
async (req: ExpressRequest, res: ExpressResponse) => {
try {
const fileName: string = req.params["file"] as string;
const blogPost: BlogPost | null = await BlogPostUtil.getBlogPost(
fileName
);
const blogPost: BlogPost | null =
await BlogPostUtil.getBlogPost(fileName);
if (!blogPost) {
return NotFoundUtil.renderNotFound(res);
}
if (!blogPost) {
return NotFoundUtil.renderNotFound(res);
}
res.render(`${ViewsPath}/Blog/Post`, {
support: false,
footerCards: true,
cta: true,
blackLogo: false,
requestDemoCta: false,
blogPost: blogPost,
});
} catch (e) {
logger.error(e);
return ServerErrorUtil.renderServerError(res);
}
res.render(`${ViewsPath}/Blog/Post`, {
support: false,
footerCards: true,
cta: true,
blackLogo: false,
requestDemoCta: false,
blogPost: blogPost,
});
} catch (e) {
logger.error(e);
return ServerErrorUtil.renderServerError(res);
}
},
);
// List all blog posts with tag
app.get(
'/blog/tag/:tagName',
async (req: ExpressRequest, res: ExpressResponse) => {
try {
const tagName: string = req.params['tagName'] as string;
"/blog/tag/:tagName",
async (req: ExpressRequest, res: ExpressResponse) => {
try {
const tagName: string = req.params["tagName"] as string;
const blogPosts: Array<BlogPostHeader> =
await BlogPostUtil.getBlogPostList(tagName);
const blogPosts: Array<BlogPostHeader> =
await BlogPostUtil.getBlogPostList(tagName);
res.render(`${ViewsPath}/Blog/ListByTag`, {
support: false,
footerCards: true,
cta: true,
blackLogo: false,
requestDemoCta: false,
blogPosts: blogPosts,
tagName: Text.fromDashesToPascalCase(tagName),
});
} catch (e) {
logger.error(e);
return ServerErrorUtil.renderServerError(res);
}
res.render(`${ViewsPath}/Blog/ListByTag`, {
support: false,
footerCards: true,
cta: true,
blackLogo: false,
requestDemoCta: false,
blogPosts: blogPosts,
tagName: Text.fromDashesToPascalCase(tagName),
});
} catch (e) {
logger.error(e);
return ServerErrorUtil.renderServerError(res);
}
},
);
// main blog page
app.get('/blog', async (_req: ExpressRequest, res: ExpressResponse) => {
try {
const blogPosts: Array<BlogPostHeader> =
await BlogPostUtil.getBlogPostList();
app.get("/blog", async (_req: ExpressRequest, res: ExpressResponse) => {
try {
const blogPosts: Array<BlogPostHeader> =
await BlogPostUtil.getBlogPostList();
res.render(`${ViewsPath}/Blog/List`, {
support: false,
footerCards: true,
cta: true,
blackLogo: false,
requestDemoCta: false,
blogPosts: blogPosts,
});
} catch (e) {
logger.error(e);
return ServerErrorUtil.renderServerError(res);
}
res.render(`${ViewsPath}/Blog/List`, {
support: false,
footerCards: true,
cta: true,
blackLogo: false,
requestDemoCta: false,
blogPosts: blogPosts,
});
} catch (e) {
logger.error(e);
return ServerErrorUtil.renderServerError(res);
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" width="302" height="135" viewBox="0 0 302 135" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M225.829 109.243C225.862 105.573 225.426 101.97 223.866 98.6024C221.081 92.5075 215.51 91.2447 211.014 92.8274C208.028 93.8713 206.149 96.1779 204.84 98.9559C202.894 103.098 202.508 107.509 202.894 112.021C203.179 115.203 203.967 118.234 205.662 120.961C206.954 123.032 208.682 124.649 211.031 125.44C216.232 127.208 221.366 124.901 223.782 119.716C225.325 116.399 225.795 112.863 225.795 109.243M202.004 127.932C202.004 129.178 202.021 131.164 202.004 132.41C201.971 133.825 201.619 134.195 200.31 134.212C198.364 134.246 196.417 134.246 194.471 134.212C193.246 134.195 192.961 133.892 192.844 132.68C192.81 132.242 192.827 131.804 192.827 131.367V67.0336C192.827 64.2219 192.861 64.1882 195.595 64.1882C197.323 64.1882 199.052 64.1714 200.78 64.1882C202.474 64.2219 202.726 64.4576 202.726 66.2086C202.726 73.2295 202.726 80.2504 202.726 87.2713V89.056C203.951 88.0121 204.89 87.0524 205.981 86.2948C211.886 82.1698 218.883 82.4392 224.352 85.2677C228.882 87.6922 232.355 92.1876 234.067 97.4238C236.801 105.825 236.768 114.26 233.312 122.477C230.828 128.386 226.701 132.73 220.359 134.313C213.615 135.997 207.608 134.582 202.894 129.127C202.407 128.555 202.155 127.831 202.004 127.915" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M151.135 109.344C151.252 112.964 151.47 116.601 153.014 119.985C154.071 122.275 155.564 124.211 157.98 125.103C161.084 126.518 165.882 126.265 169.12 123.15C170.261 122.039 171.301 120.709 172.023 119.278C174.539 114.227 174.942 108.873 173.868 103.384C173.315 100.572 172.09 98.0636 170.194 95.858C165.932 90.908 156.587 90.4534 153.165 98.3161C151.621 101.852 151.269 105.539 151.135 109.344ZM174.841 89.2412C174.841 88.231 174.841 87.2208 174.841 86.2274C174.858 84.3922 175.093 84.1397 176.905 84.1228C178.851 84.106 180.797 84.0892 182.744 84.1228C184.153 84.1565 184.421 84.4596 184.438 85.8907C184.472 87.7427 184.438 131.602 184.438 131.602C184.438 134.094 184.321 134.195 181.905 134.212C180.227 134.212 178.549 134.229 176.871 134.212C175.613 134.178 175.345 133.959 175.227 132.697C175.093 131.367 175.076 129.733 174.992 128.386C174.992 128.386 174.422 128.942 174.019 129.363C171.1 132.73 167.409 134.515 163.013 134.885C153.651 135.677 146.923 130.39 143.635 122.359C141.387 116.904 140.967 111.179 141.471 105.371C141.856 100.993 142.947 96.8008 145.128 92.9621C147.93 88.0626 151.873 84.5943 157.493 83.5167C163.6 82.3381 169.087 83.6514 173.516 88.332C173.835 88.6687 174.17 88.9886 174.489 89.3254C174.489 89.3254 174.741 89.6284 174.791 89.6116C174.808 89.6116 174.791 89.2412 174.791 89.2412" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M74.6115 80.2504L81.8427 87.0692L66.0046 104.209C66.7093 105.438 77.145 123.47 81.8931 131.451C83.0339 133.37 82.5977 134.38 80.2488 134.246C78.1516 134.111 76.0376 134.145 73.9237 134.246C72.6821 134.296 71.9607 133.841 71.3399 132.764C67.6656 126.164 59.1761 111.348 59.1761 111.348C59.1761 111.348 53.5388 117.729 52.2134 119.177C51.5926 119.85 51.3074 120.574 51.3241 121.517C51.3745 124.884 51.3577 132.511 51.3074 132.949C51.2235 133.774 50.7537 134.229 49.9148 134.229C47.5324 134.229 45.1667 134.229 42.7843 134.229C41.9454 134.229 41.4756 133.791 41.4085 132.949V66.7811C41.3918 64.2724 41.4756 64.1882 43.9084 64.1882C45.8043 64.1882 47.7002 64.1545 49.5793 64.1882C50.955 64.2219 51.257 64.5586 51.3241 65.9561C51.3409 66.3938 51.3241 104.781 51.3241 105.354L74.6115 80.2335V80.2504Z" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M270.675 104.142H292.436C292.218 100.875 291.53 97.8784 289.416 95.4371C286.514 92.0866 282.722 91.6657 278.729 92.6254C274.249 93.7029 270.625 99.0064 270.692 104.142M270.407 112.998C271.011 117.342 272.185 121.197 275.759 123.891C277.789 125.423 280.121 126.012 282.604 125.979C285.977 125.945 289.114 125.036 291.849 122.982C292.067 122.813 292.302 122.679 292.637 122.46C295.003 124.177 297.402 125.911 299.902 127.73C297.302 130.323 294.517 132.293 291.211 133.471C286.178 135.239 281.027 135.525 275.91 134.06C268.813 132.023 264.25 127.124 262.001 120.187C259.334 111.954 259.451 103.653 262.907 95.6391C265.793 88.9718 270.81 84.6616 278.041 83.4494C283.98 82.4392 289.584 83.4157 294.366 87.406C298.426 90.7901 300.506 95.3024 301.462 100.438C302.134 104.041 302.066 107.694 301.848 111.331C301.764 112.661 301.462 112.93 300.187 112.981C299.801 112.981 271.128 112.981 270.424 112.981" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M33.523 90.4702C33.8754 89.881 33.1371 89.1402 32.9861 89.0055C26.7281 83.9713 19.5976 82.0688 11.6785 83.6851C7.0143 84.6279 3.22255 87.6417 1.36023 91.7667C-0.602759 96.3968 -0.585981 100.976 2.36689 105.253C3.89366 107.458 6.05798 108.957 8.47396 109.95C12.3999 111.482 21.4767 114.648 23.7416 115.759C24.7147 116.18 25.4697 116.904 25.8389 117.931C26.812 120.473 26.5267 124.514 22.2652 125.743C19.866 126.433 17.45 126.316 15.034 125.895C11.3262 125.255 9.12829 124.362 6.25931 121.921C5.90698 121.618 5.25265 121.601 4.93387 121.921C4.56476 122.292 0.135458 127.141 0.135458 127.141C-0.23365 127.915 0.252902 128.37 1.17567 129.195C1.89711 129.834 4.4641 131.602 5.60498 132.141C11.3597 134.852 17.3997 135.609 23.6242 134.498C30.2346 133.32 34.731 129.38 35.6035 122.426C36.1236 118.234 35.5699 114.26 32.6003 110.994C30.8554 109.075 28.6911 107.711 26.3086 106.802C23.2886 105.64 14.7656 102.946 12.3328 101.633C10.5879 100.875 9.69873 99.5284 9.71551 97.5417C9.71551 95.4371 10.5208 93.8207 12.3664 92.8611C13.1717 92.457 14.0945 92.1876 14.9837 92.0697C19.262 91.5478 23.1209 92.6759 26.5771 95.2014C26.812 95.3697 27.0301 95.5381 27.265 95.7233C27.7683 96.1105 28.4729 96.0432 28.9092 95.5886C28.9092 95.5886 33.3217 90.8407 33.523 90.5039" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M242.975 99.0906V66.7811C242.975 64.3229 243.11 64.1882 245.542 64.1882C247.438 64.1882 249.317 64.1545 251.213 64.1882C252.539 64.2219 252.824 64.5249 252.874 65.8214C252.891 66.1413 252.874 110.001 252.874 131.585C252.874 134.094 252.774 134.195 250.358 134.195C248.462 134.195 246.583 134.212 244.687 134.195C243.412 134.178 243.059 133.808 242.992 132.545C242.959 132.107 242.992 109.816 242.992 99.0906" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M124.089 134.178H134.005V62.3362H124.089V134.178Z" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M105.717 134.178H115.616V82.3381H105.717V134.178Z" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M87.3458 134.178H97.2279V96.9019H87.3458V134.178Z" fill="#a5b4fc"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M146.705 0L90.834 63.307L83.1227 56.057L72 68.585L90.748 87L158 11.136L146.705 0Z" fill="#a5b4fc"></path>
</svg>

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -1,47 +0,0 @@
(function (e, t) {
var n = e.amplitude || { _q: [], _iq: {} }; var r = t.createElement("script")
; r.type = "text/javascript"
; r.integrity = "sha384-vYYnQ3LPdp/RkQjoKBTGSq0X5F73gXU3G2QopHaIfna0Ct1JRWzwrmEz115NzOta"
; r.crossOrigin = "anonymous"; r.async = true
; r.src = "https://cdn.amplitude.com/libs/amplitude-5.8.0-min.gz.js"
; r.onload = function () {
if (!e.amplitude.runQueuedFunctions) {
console.log("[Amplitude] Error: could not load SDK")
}
}
; var i = t.getElementsByTagName("script")[0]; i.parentNode.insertBefore(r, i)
; function s(e, t) {
e.prototype[t] = function () {
this._q.push([t].concat(Array.prototype.slice.call(arguments, 0))); return this
}
}
var o = function () { this._q = []; return this }
; var a = ["add", "append", "clearAll", "prepend", "set", "setOnce", "unset"]
; for (var u = 0; u < a.length; u++) { s(o, a[u]) } n.Identify = o; var c = function () {
this._q = []
; return this
}
; var l = ["setProductId", "setQuantity", "setPrice", "setRevenueType", "setEventProperties"]
; for (var p = 0; p < l.length; p++) { s(c, l[p]) } n.Revenue = c
; var d = ["init", "logEvent", "logRevenue", "setUserId", "setUserProperties", "setOptOut", "setVersionName", "setDomain", "setDeviceId", "enableTracking", "setGlobalUserProperties", "identify", "clearUserProperties", "setGroup", "logRevenueV2", "regenerateDeviceId", "groupIdentify", "onInit", "logEventWithTimestamp", "logEventWithGroups", "setSessionId", "resetSessionId"]
; function v(e) {
function t(t) {
e[t] = function () {
e._q.push([t].concat(Array.prototype.slice.call(arguments, 0)))
}
}
for (var n = 0; n < d.length; n++) { t(d[n]) }
} v(n); n.getInstance = function (e) {
e = (!e || e.length === 0 ? "$default_instance" : e).toLowerCase()
; if (!n._iq.hasOwnProperty(e)) { n._iq[e] = { _q: [] }; v(n._iq[e]) } return n._iq[e]
}
; e.amplitude = n
})(window, document);
amplitude.getInstance().init("802d95003af23aad17ed068b6cfdeb2b", null, {
// include referrer information in amplitude.
saveEvents: true,
includeUtm: true,
includeReferrer: true,
includeGclid: true
});

View File

@@ -1,94 +1,95 @@
function openTab(evt, tabName) {
// Declare all variables
let i;
// Declare all variables
let i;
// Get all elements with class="tabcontent" and hide them
const tabcontent = document.getElementsByClassName('tabcontent');
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].className = tabcontent[i].className.replace(' active', '');
}
// Get all elements with class="tabcontent" and hide them
const tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].className = tabcontent[i].className.replace(" active", "");
}
// Get all elements with class="tablinks" and remove the class "active"
const tablinks = document.getElementsByClassName('tablinks');
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(' active', '');
}
// Get all elements with class="tablinks" and remove the class "active"
const tablinks = document.getElementsByClassName("tablinks");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the link that opened the tab
// Show the current tab, and add an "active" class to the link that opened the tab
document.getElementById(tabName).className += ' active';
evt.currentTarget.className += ' active';
document.getElementById(tabName).className += " active";
evt.currentTarget.className += " active";
setTimeout(() => document.getElementById(tabName + '1').parentNode.click(), 200);
setTimeout(
() => document.getElementById(tabName + "1").parentNode.click(),
200,
);
}
function openTooltip(name) {
// Declare all variables
let i;
const element = document.getElementById(name);
// Declare all variables
let i;
const element = document.getElementById(name);
const elclass = element.className;
const elclass = element.className;
const tooltip = document.getElementsByClassName('tooltiptext');
for (i = 0; i < tooltip.length; i++) {
tooltip[i].className = tooltip[i].className.replace(' active', '');
}
if (elclass.indexOf('active') > -1) {
element.className = element.className.replace(' active', '');
}
else {
element.classList.add('active');
}
const tooltip = document.getElementsByClassName("tooltiptext");
for (i = 0; i < tooltip.length; i++) {
tooltip[i].className = tooltip[i].className.replace(" active", "");
}
if (elclass.indexOf("active") > -1) {
element.className = element.className.replace(" active", "");
} else {
element.classList.add("active");
}
}
window.onload = function () {
animateHTML().init();
const tooltext = document.getElementsByClassName('tooltiptext');
for (let i = 0; i < tooltext.length; i++) {
animateHTML().init();
const tooltext = document.getElementsByClassName("tooltiptext");
for (let i = 0; i < tooltext.length; i++) {
tooltext[i].onclick = function (e) {
e.stopPropagation();
};
}
tooltext[i].onclick = function (e) {
e.stopPropagation();
}
document.getElementsByTagName("body")[0].onclick = function (e) {
if (
e.target.className !== "popover-dot" &&
e.target.className !== "tooltiptext" &&
e.target.className !== "tablinks active"
) {
const tooltip = document.getElementsByClassName("tooltiptext");
for (let i = 0; i < tooltip.length; i++) {
tooltip[i].className = tooltip[i].className.replace(" active", "");
}
}
document.getElementsByTagName('body')[0].onclick = function (e) {
if (e.target.className !== 'popover-dot' && e.target.className !== 'tooltiptext' && e.target.className !== 'tablinks active') {
const tooltip = document.getElementsByClassName('tooltiptext');
for (let i = 0; i < tooltip.length; i++) {
tooltip[i].className = tooltip[i].className.replace(' active', '');
}
}
}
}
};
};
const animateHTML = function () {
let elem, windowHeight;
const init = function () {
elem = document.getElementById('Statuspage');
windowHeight = window.innerHeight;
_addEventHandlers();
let elem, windowHeight;
const init = function () {
elem = document.getElementById("Statuspage");
windowHeight = window.innerHeight;
_addEventHandlers();
};
const _addEventHandlers = function () {
window.addEventListener("scroll", _checkPosition);
window.addEventListener("resize", init);
};
const _checkPosition = function () {
if (!elem) {
return;
}
const _addEventHandlers = function () {
window.addEventListener('scroll', _checkPosition)
window.addEventListener('resize', init)
}
const _checkPosition = function () {
if (!elem) {
return;
}
const posFromTop = elem.getBoundingClientRect().top;
const posFromTop = elem.getBoundingClientRect().top;
if (posFromTop - windowHeight <= -400) {
document.getElementById('Statuspage1').parentNode.click();
window.removeEventListener('scroll', _checkPosition);
window.removeEventListener('resize', init);
return;
}
if (posFromTop - windowHeight <= -400) {
document.getElementById("Statuspage1").parentNode.click();
window.removeEventListener("scroll", _checkPosition);
window.removeEventListener("resize", init);
return;
}
return {
init: init
}
}
};
return {
init: init,
};
};

View File

@@ -1,5 +1,5 @@
// This is basicaly meant to get a cookie by name
var getCookiebyName = function (name) {
var pair = document.cookie.match(new RegExp(name + '=([^;]+)'));
return !!pair ? pair[1] : null;
};
var pair = document.cookie.match(new RegExp(name + "=([^;]+)"));
return pair ? pair[1] : null;
};

Some files were not shown because too many files have changed in this diff Show More