feat: fixed review comments

This commit is contained in:
=
2024-12-13 21:38:43 +05:30
parent 9b4e1f561e
commit c57fc5e3f1
37 changed files with 148 additions and 83 deletions
+21 -3
View File
@@ -1,6 +1,6 @@
import { apiRequest } from "@app/config/request";
import { createWorkspace } from "@app/hooks/api/workspace/queries";
import { ProjectType } from "@app/hooks/api/workspace/types";
import { ProjectType, Workspace } from "@app/hooks/api/workspace/types";
const secretsToBeAdded = [
{
@@ -37,7 +37,7 @@ const secretsToBeAdded = [
* Create and initialize a new project in organization with id [organizationId]
* Note: current user should be a member of the organization
*/
const initProjectHelper = async ({ projectName }: { projectName: string }) => {
export const initProjectHelper = async ({ projectName }: { projectName: string }) => {
// create new project
const {
data: { project }
@@ -61,4 +61,22 @@ const initProjectHelper = async ({ projectName }: { projectName: string }) => {
return project;
};
export { initProjectHelper };
export const getProjectHomePage = (workspace: Workspace) => {
if (workspace.type === ProjectType.SecretManager) {
return `/${workspace.type}/${workspace.id}/secrets/overview`;
}
if (workspace.type === ProjectType.CertificateManager) {
return `/${workspace.type}/${workspace.id}/certificates`;
}
return `/${workspace.type}/${workspace.id}/kms`;
};
export const getProjectTitle = (type: ProjectType) => {
const titleConvert = {
[ProjectType.SecretManager]: "Secret Management",
[ProjectType.KMS]: "Key Management",
[ProjectType.CertificateManager]: "Cert Management"
};
return titleConvert[type];
};