diff --git a/Taskfile.yaml b/Taskfile.yaml index f33ce8ae1..23616353e 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -9,7 +9,7 @@ tasks: cmds: - | BASE_URL=dev.kloudlite.io - COOKIE_DOMAIN=".kloudlite.io" + COOKIE_DOMAIN=".dev.kloudlite.io" GATEWAY_URL="http://gateway-api.kloudlite.svc.cluster.local:3000" case {{.app}} in "auth") @@ -217,5 +217,16 @@ tasks: vars: Image: ghcr.io/kloudlite/web/events:{{.tag}} cmds: - # - docker buildx build -t {{.Image}} --platform linux/amd64 -f Dockerfile.webinar --push . - docker buildx build . -t {{.Image}} --platform linux/amd64 -f Dockerfile.webinar --output=type=image,compression=zstd,force-compression=true,compression-level=12,push=true + + container-push-dashboard: + preconditions: + - sh: '[[ -n "{{.app}}" ]]' + msg: "var app must have a value" + - sh: '[[ -n "{{.tag}}" ]]' + msg: "var tag must have a value" + silent: true + vars: + IMAGE: ghcr.io/kloudlite/web/{{.app}}:{{.tag}} + cmds: + - docker buildx build --build-arg APP={{.app}} . -t {{.IMAGE}} --platform linux/amd64 --output=type=image,compression=zstd,force-compression=true,compression-level=12,push=true diff --git a/gql-queries-generator/doc/queries.graphql b/gql-queries-generator/doc/queries.graphql index be22aa33f..c6a113d12 100644 --- a/gql-queries-generator/doc/queries.graphql +++ b/gql-queries-generator/doc/queries.graphql @@ -787,6 +787,10 @@ mutation consoleCreateEnvironment($env: EnvironmentIn!) { } } +mutation consoleSetupDefaultEnvironment { + core_setupDefaultEnvironment +} + mutation consoleUpdateEnvironment($env: EnvironmentIn!) { core_updateEnvironment(env: $env) { id @@ -4526,1690 +4530,155 @@ query consoleListRegistryImages($pq: CursorPaginationIn) { } } -query iotconsoleAccountCheckNameAvailability($name: String!) { - accounts_checkNameAvailability(name: $name) { - result - suggestedNames - } -} - -query iotconsoleCrCheckNameAvailability($name: String!) { - cr_checkUserNameAvailability(name: $name) { - result - suggestedNames - } -} - -query iotconsoleInfraCheckNameAvailability($resType: ResType!, $name: String!, $clusterName: String) { - infra_checkNameAvailability( - resType: $resType - name: $name - clusterName: $clusterName - ) { - suggestedNames - result - } -} - -query iotconsoleCoreCheckNameAvailability($resType: ConsoleResType!, $name: String!, $projectName: String, $envName: String) { - core_checkNameAvailability(resType: $resType, name: $name, envName: $envName) { - result - } -} - -query iotconsoleWhoAmI { - auth_me { - id - email - providerGitlab - providerGithub - providerGoogle - } -} - -mutation iotconsoleCreateAccount($account: AccountIn!) { - accounts_createAccount(account: $account) { - displayName - } -} - -query iotconsoleListAccounts { - accounts_listAccounts { - id - metadata { - name - annotations - } - updateTime - displayName - } -} - -mutation iotconsoleUpdateAccount($account: AccountIn!) { - accounts_updateAccount(account: $account) { - id - } -} - -query iotconsoleGetAccount($accountName: String!) { - accounts_getAccount(accountName: $accountName) { - metadata { - name - annotations - } - targetNamespace - updateTime - contactEmail - displayName - } -} - -mutation iotconsoleDeleteAccount($accountName: String!) { - accounts_deleteAccount(accountName: $accountName) -} - -mutation iotconsoleDeleteIotProject($name: String!) { - iot_deleteProject(name: $name) -} - -mutation iotconsoleCreateIotProject($project: IOTProjectIn!) { - iot_createProject(project: $project) { - id - } -} - -mutation iotconsoleUpdateIotProject($project: IOTProjectIn!) { - iot_updateProject(project: $project) { - id - } -} - -query iotconsoleGetIotProject($name: String!) { - iot_getProject(name: $name) { +mutation authCli_createGlobalVPNDevice($gvpnDevice: GlobalVPNDeviceIn!) { + infra_createGlobalVPNDevice(gvpnDevice: $gvpnDevice) { accountName + creationTime createdBy { userEmail userId userName } - creationTime displayName + globalVPNName id + ipAddr lastUpdatedBy { - userEmail - userId userName + userId + userEmail } markedForDeletion - name + metadata { + annotations + creationTimestamp + deletionTimestamp + generation + labels + name + namespace + } + privateKey + publicKey recordVersion updateTime - } -} - -query iotconsoleListIotProjects($search: SearchIOTProjects, $pq: CursorPaginationIn) { - iot_listProjects(search: $search, pq: $pq) { - edges { - node { - displayName - name - creationTime - markedForDeletion - updateTime - createdBy { - userEmail - userName - userId - } - lastUpdatedBy { - userEmail - userName - userId - } - } - cursor - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor + wireguardConfig { + value + encoding } - totalCount } } -mutation iotconsoleDeleteIotDeviceBlueprint($projectName: String!, $name: String!) { - iot_deleteDeviceBlueprint(projectName: $projectName, name: $name) -} - -mutation iotconsoleCreateIotDeviceBlueprint($deviceBlueprint: IOTDeviceBlueprintIn!, $projectName: String!) { - iot_createDeviceBlueprint( - projectName: $projectName - deviceBlueprint: $deviceBlueprint - ) { - id - } +query authCli_getDNSHostSuffix { + core_getDNSHostSuffix } -mutation iotconsoleUpdateIotDeviceBlueprint($deviceBlueprint: IOTDeviceBlueprintIn!, $projectName: String!) { - iot_updateDeviceBlueprint( - projectName: $projectName - deviceBlueprint: $deviceBlueprint - ) { - id +query authCli_getMresOutputKeyValues($msvcName: String!, $keyrefs: [ManagedResourceKeyRefIn]) { + core_getManagedResouceOutputKeyValues(msvcName: $msvcName, keyrefs: $keyrefs) { + key + mresName + value } } -query iotconsoleGetIotDeviceBlueprint($projectName: String!, $name: String!) { - iot_getDeviceBlueprint(projectName: $projectName, name: $name) { +query authCli_getGlobalVpnDevice($gvpn: String!, $deviceName: String!) { + infra_getGlobalVPNDevice(gvpn: $gvpn, deviceName: $deviceName) { accountName - bluePrintType + creationTime createdBy { userEmail userId userName } - creationTime displayName + globalVPNName id + ipAddr lastUpdatedBy { - userEmail - userId userName + userId + userEmail } markedForDeletion - name + metadata { + annotations + creationTimestamp + deletionTimestamp + generation + labels + name + namespace + } + privateKey + publicKey recordVersion updateTime - version + wireguardConfig { + value + encoding + } + } +} + +query authCli_coreCheckNameAvailability($resType: ConsoleResType!, $name: String!) { + core_checkNameAvailability(resType: $resType, name: $name) { + result + suggestedNames } } -query iotconsoleListIotDeviceBlueprints($search: SearchIOTDeviceBlueprints, $pq: CursorPaginationIn, $projectName: String!) { - iot_listDeviceBlueprints(projectName: $projectName, search: $search, pq: $pq) { +query authCli_getMresKeys($name: String!, $envName: String) { + core_getManagedResouceOutputKeys(name: $name, envName: $envName) +} + +query authCli_listMreses($pq: CursorPaginationIn, $search: SearchManagedResources) { + core_listManagedResources(pq: $pq, search: $search) { edges { - cursor node { - accountName - bluePrintType - createdBy { - userEmail - userId - userName - } - creationTime displayName - id - lastUpdatedBy { - userEmail - userId - userName + metadata { + name + namespace } - markedForDeletion - name - recordVersion - updateTime - version } } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount } } -mutation iotconsoleDeleteIotDeployment($projectName: String!, $name: String!) { - iot_deleteDeployment(projectName: $projectName, name: $name) +query authCli_getMresConfigsValues($keyrefs: [ManagedResourceKeyRefIn], $envName: String) { + core_getManagedResouceOutputKeyValues(keyrefs: $keyrefs, envName: $envName) { + key + mresName + value + } } -mutation iotconsoleCreateIotDeployment($projectName: String!, $deployment: IOTDeploymentIn!) { - iot_createDeployment(projectName: $projectName, deployment: $deployment) { - id +query authCli_infraCheckNameAvailability($resType: ResType!, $name: String!, $clusterName: String) { + infra_checkNameAvailability( + resType: $resType + name: $name + clusterName: $clusterName + ) { + result + suggestedNames } } -mutation iotconsoleUpdateIotDeployment($projectName: String!, $deployment: IOTDeploymentIn!) { - iot_updateDeployment(projectName: $projectName, deployment: $deployment) { - id - } -} - -query iotconsoleGetIotDeployment($projectName: String!, $name: String!) { - iot_getDeployment(projectName: $projectName, name: $name) { - accountName - CIDR - createdBy { - userEmail - userId - userName - } - creationTime - displayName - exposedServices { - ip - name - } - id - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - recordVersion - updateTime - } -} - -query iotconsoleListIotDeployments($search: SearchIOTDeployments, $pq: CursorPaginationIn, $projectName: String!) { - iot_listDeployments(projectName: $projectName, search: $search, pq: $pq) { - edges { - cursor - node { - accountName - CIDR - createdBy { - userEmail - userId - userName - } - creationTime - displayName - exposedServices { - ip - name - } - id - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - recordVersion - updateTime - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleDeleteIotApp($projectName: String!, $deviceBlueprintName: String!, $name: String!) { - iot_deleteApp( - projectName: $projectName - deviceBlueprintName: $deviceBlueprintName - name: $name - ) -} - -mutation iotconsoleCreateIotApp($deviceBlueprintName: String!, $app: IOTAppIn!, $projectName: String!) { - iot_createApp( - projectName: $projectName - deviceBlueprintName: $deviceBlueprintName - app: $app - ) { - id - } -} - -mutation iotconsoleUpdateIotApp($projectName: String!, $deviceBlueprintName: String!, $app: IOTAppIn!) { - iot_updateApp( - projectName: $projectName - deviceBlueprintName: $deviceBlueprintName - app: $app - ) { - id - } -} - -query iotconsoleGetIotApp($projectName: String!, $deviceBlueprintName: String!, $name: String!) { - iot_getApp( - projectName: $projectName - deviceBlueprintName: $deviceBlueprintName - name: $name - ) { - accountName - apiVersion - createdBy { - userEmail - userId - userName - } - creationTime - deviceBlueprintName - displayName - enabled - id - kind - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - metadata { - annotations - labels - name - namespace - } - recordVersion - spec { - containers { - args - command - env { - key - optional - refKey - refName - type - value - } - envFrom { - refName - type - } - image - imagePullPolicy - livenessProbe { - failureThreshold - httpGet { - httpHeaders - path - port - } - initialDelay - interval - shell { - command - } - tcp { - port - } - type - } - name - readinessProbe { - failureThreshold - initialDelay - interval - type - } - resourceCpu { - max - min - } - resourceMemory { - max - min - } - volumes { - items { - fileName - key - } - mountPath - refName - type - } - } - displayName - freeze - hpa { - enabled - maxReplicas - minReplicas - thresholdCpu - thresholdMemory - } - intercept { - enabled - toDevice - } - nodeSelector - region - replicas - serviceAccount - services { - port - } - tolerations { - effect - key - operator - tolerationSeconds - value - } - topologySpreadConstraints { - labelSelector { - matchExpressions { - key - operator - values - } - matchLabels - } - matchLabelKeys - maxSkew - minDomains - nodeAffinityPolicy - nodeTaintsPolicy - topologyKey - whenUnsatisfiable - } - } - status { - checkList { - debug - description - name - title - } - checks - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - updateTime - } -} - -query iotconsoleListIotApps($deviceBlueprintName: String!, $search: SearchIOTApps, $pq: CursorPaginationIn, $projectName: String!) { - iot_listApps( - projectName: $projectName - deviceBlueprintName: $deviceBlueprintName - search: $search - pq: $pq - ) { - edges { - cursor - node { - accountName - apiVersion - createdBy { - userEmail - userId - userName - } - creationTime - deviceBlueprintName - displayName - enabled - id - kind - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - metadata { - annotations - creationTimestamp - labels - name - namespace - } - recordVersion - spec { - containers { - args - command - env { - key - optional - refKey - refName - type - value - } - envFrom { - refName - type - } - image - imagePullPolicy - livenessProbe { - failureThreshold - httpGet { - httpHeaders - path - port - } - initialDelay - interval - shell { - command - } - tcp { - port - } - type - } - name - readinessProbe { - failureThreshold - initialDelay - interval - type - } - resourceCpu { - max - min - } - resourceMemory { - max - min - } - volumes { - items { - fileName - key - } - mountPath - refName - type - } - } - displayName - freeze - hpa { - enabled - maxReplicas - minReplicas - thresholdCpu - thresholdMemory - } - intercept { - enabled - toDevice - } - nodeSelector - region - replicas - serviceAccount - services { - port - } - tolerations { - effect - key - operator - tolerationSeconds - value - } - topologySpreadConstraints { - labelSelector { - matchExpressions { - key - operator - values - } - matchLabels - } - matchLabelKeys - maxSkew - minDomains - nodeAffinityPolicy - nodeTaintsPolicy - topologyKey - whenUnsatisfiable - } - } - status { - checkList { - debug - description - name - title - } - checks - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - updateTime - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleDeleteIotDevice($projectName: String!, $deploymentName: String!, $name: String!) { - iot_deleteDevice( - projectName: $projectName - deploymentName: $deploymentName - name: $name - ) -} - -mutation iotconsoleCreateIotDevice($deploymentName: String!, $device: IOTDeviceIn!, $projectName: String!) { - iot_createDevice( - projectName: $projectName - deploymentName: $deploymentName - device: $device - ) { - id - } -} - -mutation iotconsoleUpdateIotDevice($deploymentName: String!, $device: IOTDeviceIn!, $projectName: String!) { - iot_updateDevice( - projectName: $projectName - deploymentName: $deploymentName - device: $device - ) { - id - } -} - -query iotconsoleGetIotDevice($projectName: String!, $deploymentName: String!, $name: String!) { - iot_getDevice( - projectName: $projectName - deploymentName: $deploymentName - name: $name - ) { - accountName - createdBy { - userEmail - userId - userName - } - creationTime - deploymentName - displayName - id - ip - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - podCIDR - publicKey - recordVersion - serviceCIDR - updateTime - version - } -} - -query iotconsoleListIotDevices($deploymentName: String!, $search: SearchIOTDevices, $pq: CursorPaginationIn, $projectName: String!) { - iot_listDevices( - projectName: $projectName - deploymentName: $deploymentName - search: $search - pq: $pq - ) { - edges { - cursor - node { - accountName - createdBy { - userEmail - userId - userName - } - creationTime - deploymentName - displayName - id - ip - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - podCIDR - publicKey - recordVersion - serviceCIDR - updateTime - version - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -query iotconsoleListRepo($search: SearchRepos, $pagination: CursorPaginationIn) { - cr_listRepos(search: $search, pagination: $pagination) { - edges { - cursor - node { - accountName - createdBy { - userEmail - userId - userName - } - creationTime - id - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - recordVersion - updateTime - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleCreateRepo($repository: RepositoryIn!) { - cr_createRepo(repository: $repository) { - id - } -} - -mutation iotconsoleDeleteRepo($name: String!) { - cr_deleteRepo(name: $name) -} - -query iotconsoleListDigest($repoName: String!, $search: SearchRepos, $pagination: CursorPaginationIn) { - cr_listDigests(repoName: $repoName, search: $search, pagination: $pagination) { - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - edges { - cursor - node { - url - updateTime - tags - size - repository - digest - creationTime - } - } - } -} - -mutation iotconsoleDeleteDigest($repoName: String!, $digest: String!) { - cr_deleteDigest(repoName: $repoName, digest: $digest) -} - -mutation iotconsoleUpdateConfig($envName: String!, $config: ConfigIn!) { - core_updateConfig(envName: $envName, config: $config) { - id - } -} - -mutation iotconsoleDeleteConfig($envName: String!, $configName: String!) { - core_deleteConfig(envName: $envName, configName: $configName) -} - -query iotconsoleGetConfig($envName: String!, $name: String!) { - core_getConfig(envName: $envName, name: $name) { - binaryData - data - displayName - environmentName - immutable - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - } -} - -query iotconsoleListConfigs($envName: String!, $search: SearchConfigs, $pq: CursorPaginationIn) { - core_listConfigs(envName: $envName, search: $search, pq: $pq) { - edges { - cursor - node { - createdBy { - userEmail - userId - userName - } - creationTime - displayName - data - environmentName - immutable - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - updateTime - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleCreateConfig($envName: String!, $config: ConfigIn!) { - core_createConfig(envName: $envName, config: $config) { - id - } -} - -query iotconsoleListSecrets($envName: String!, $search: SearchSecrets, $pq: CursorPaginationIn) { - core_listSecrets(envName: $envName, search: $search, pq: $pq) { - edges { - cursor - node { - createdBy { - userEmail - userId - userName - } - creationTime - displayName - stringData - environmentName - isReadyOnly - immutable - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - type - updateTime - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleCreateSecret($envName: String!, $secret: SecretIn!) { - core_createSecret(envName: $envName, secret: $secret) { - id - } -} - -query iotconsoleGetSecret($envName: String!, $name: String!) { - core_getSecret(envName: $envName, name: $name) { - data - displayName - environmentName - immutable - markedForDeletion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - stringData - type - } -} - -mutation iotconsoleUpdateSecret($envName: String!, $secret: SecretIn!) { - core_updateSecret(envName: $envName, secret: $secret) { - id - } -} - -mutation iotconsoleDeleteSecret($envName: String!, $secretName: String!) { - core_deleteSecret(envName: $envName, secretName: $secretName) -} - -query iotconsoleGetCredToken($username: String!) { - cr_getCredToken(username: $username) -} - -query iotconsoleListCred($search: SearchCreds, $pagination: CursorPaginationIn) { - cr_listCreds(search: $search, pagination: $pagination) { - edges { - cursor - node { - access - accountName - createdBy { - userEmail - userId - userName - } - creationTime - expiration { - unit - value - } - id - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - recordVersion - updateTime - username - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleCreateCred($credential: CredentialIn!) { - cr_createCred(credential: $credential) { - id - } -} - -mutation iotconsoleDeleteCred($username: String!) { - cr_deleteCred(username: $username) -} - -query iotconsoleGetGitConnections($state: String) { - auth_me { - providerGitlab - providerGithub - providerGoogle - } - githubLoginUrl: oAuth_requestLogin(provider: "github", state: $state) - gitlabLoginUrl: oAuth_requestLogin(provider: "gitlab", state: $state) -} - -query iotconsoleGetLogins { - auth_me { - providerGithub - providerGitlab - } -} - -query iotconsoleLoginUrls { - githubLoginUrl: oAuth_requestLogin( - provider: "github" - state: "redirect:add-provider" - ) - gitlabLoginUrl: oAuth_requestLogin( - provider: "gitlab" - state: "redirect:add-provider" - ) -} - -query iotconsoleListGithubRepos($installationId: Int!, $pagination: PaginationIn) { - cr_listGithubRepos(installationId: $installationId, pagination: $pagination) { - repositories { - cloneUrl - defaultBranch - fullName - private - updatedAt - } - totalCount - } -} - -query iotconsoleListGithubInstalltions($pagination: PaginationIn) { - cr_listGithubInstallations(pagination: $pagination) { - account { - avatarUrl - id - login - nodeId - type - } - appId - id - nodeId - repositoriesUrl - targetId - targetType - } -} - -query iotconsoleListGithubBranches($repoUrl: String!, $pagination: PaginationIn) { - cr_listGithubBranches(repoUrl: $repoUrl, pagination: $pagination) { - name - } -} - -query iotconsoleSearchGithubRepos($organization: String!, $search: String!, $pagination: PaginationIn) { - cr_searchGithubRepos( - organization: $organization - search: $search - pagination: $pagination - ) { - repositories { - cloneUrl - defaultBranch - fullName - private - updatedAt - } - } -} - -query iotconsoleListGitlabGroups($query: String, $pagination: PaginationIn) { - cr_listGitlabGroups(query: $query, pagination: $pagination) { - fullName - id - } -} - -query iotconsoleListGitlabRepos($query: String, $pagination: PaginationIn, $groupId: String!) { - cr_listGitlabRepositories( - query: $query - pagination: $pagination - groupId: $groupId - ) { - createdAt - name - id - public - httpUrlToRepo - } -} - -query iotconsoleListGitlabBranches($repoId: String!, $query: String, $pagination: PaginationIn) { - cr_listGitlabBranches(repoId: $repoId, query: $query, pagination: $pagination) { - name - protected - } -} - -query iotconsoleListBuilds($repoName: String!, $search: SearchBuilds, $pagination: CursorPaginationIn) { - cr_listBuilds(repoName: $repoName, search: $search, pagination: $pagination) { - edges { - cursor - node { - createdBy { - userEmail - userId - userName - } - creationTime - buildClusterName - credUser { - userEmail - userId - userName - } - errorMessages - id - lastUpdatedBy { - userEmail - userId - userName - } - markedForDeletion - name - source { - branch - provider - repository - webhookId - } - spec { - buildOptions { - buildArgs - buildContexts - contextDir - dockerfileContent - dockerfilePath - targetPlatforms - } - registry { - repo { - name - tags - } - } - resource { - cpu - memoryInMb - } - caches { - name - path - } - } - status - updateTime - latestBuildRun { - recordVersion - status { - checkList { - debug - description - name - title - } - checks - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - syncStatus { - action - error - lastSyncedAt - recordVersion - state - syncScheduledAt - } - markedForDeletion - } - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -mutation iotconsoleCreateBuild($build: BuildIn!) { - cr_addBuild(build: $build) { - id - } -} - -mutation iotconsoleUpdateBuild($crUpdateBuildId: ID!, $build: BuildIn!) { - cr_updateBuild(id: $crUpdateBuildId, build: $build) { - id - } -} - -mutation iotconsoleDeleteBuild($crDeleteBuildId: ID!) { - cr_deleteBuild(id: $crDeleteBuildId) -} - -mutation iotconsoleTriggerBuild($crTriggerBuildId: ID!) { - cr_triggerBuild(id: $crTriggerBuildId) -} - -query iotconsoleListBuildRuns($search: SearchBuildRuns, $pq: CursorPaginationIn) { - cr_listBuildRuns(search: $search, pq: $pq) { - edges { - cursor - node { - id - clusterName - creationTime - markedForDeletion - recordVersion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - spec { - accountName - buildOptions { - buildArgs - buildContexts - contextDir - dockerfileContent - dockerfilePath - targetPlatforms - } - registry { - repo { - name - tags - } - } - resource { - cpu - memoryInMb - } - } - status { - checks - checkList { - description - debug - name - title - } - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - syncStatus { - action - error - lastSyncedAt - recordVersion - state - syncScheduledAt - } - updateTime - } - } - pageInfo { - endCursor - hasNextPage - hasPrevPage - startCursor - } - totalCount - } -} - -query iotconsoleGetBuildRun($buildId: ID!, $buildRunName: String!) { - cr_getBuildRun(buildID: $buildId, buildRunName: $buildRunName) { - clusterName - creationTime - markedForDeletion - recordVersion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - spec { - accountName - buildOptions { - buildArgs - buildContexts - contextDir - dockerfileContent - dockerfilePath - targetPlatforms - } - registry { - repo { - name - tags - } - } - resource { - cpu - memoryInMb - } - } - status { - checks - checkList { - description - debug - name - title - } - isReady - lastReadyGeneration - lastReconcileTime - message { - RawMessage - } - resources { - apiVersion - kind - name - namespace - } - } - syncStatus { - action - error - lastSyncedAt - recordVersion - state - syncScheduledAt - } - updateTime - } -} - -query iotconsoleListInvitationsForAccount($accountName: String!) { - accounts_listInvitations(accountName: $accountName) { - accepted - accountName - creationTime - id - inviteToken - invitedBy - markedForDeletion - recordVersion - rejected - updateTime - userEmail - userName - userRole - } -} - -query iotconsoleListMembershipsForAccount($accountName: String!) { - accounts_listMembershipsForAccount(accountName: $accountName) { - user { - verified - name - joined - email - } - role - } -} - -mutation iotconsoleDeleteAccountInvitation($accountName: String!, $invitationId: String!) { - accounts_deleteInvitation( - accountName: $accountName - invitationId: $invitationId - ) -} - -mutation iotconsoleInviteMembersForAccount($accountName: String!, $invitations: [InvitationIn!]!) { - accounts_inviteMembers(accountName: $accountName, invitations: $invitations) { - id - } -} - -query iotconsoleListInvitationsForUser($onlyPending: Boolean!) { - accounts_listInvitationsForUser(onlyPending: $onlyPending) { - accountName - id - updateTime - inviteToken - } -} - -mutation iotconsoleAcceptInvitation($accountName: String!, $inviteToken: String!) { - accounts_acceptInvitation(accountName: $accountName, inviteToken: $inviteToken) -} - -mutation iotconsoleRejectInvitation($accountName: String!, $inviteToken: String!) { - accounts_rejectInvitation(accountName: $accountName, inviteToken: $inviteToken) -} - -mutation iotconsoleUpdateAccountMembership($accountName: String!, $memberId: ID!, $role: Github__com___kloudlite___api___apps___iam___types__Role!) { - accounts_updateAccountMembership( - accountName: $accountName - memberId: $memberId - role: $role - ) -} - -mutation iotconsoleDeleteAccountMembership($accountName: String!, $memberId: ID!) { - accounts_removeAccountMembership(accountName: $accountName, memberId: $memberId) -} - -mutation authCli_createGlobalVPNDevice($gvpnDevice: GlobalVPNDeviceIn!) { - infra_createGlobalVPNDevice(gvpnDevice: $gvpnDevice) { - accountName - creationTime - createdBy { - userEmail - userId - userName - } - displayName - globalVPNName - id - ipAddr - lastUpdatedBy { - userName - userId - userEmail - } - markedForDeletion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - privateKey - publicKey - recordVersion - updateTime - wireguardConfig { - value - encoding - } - } -} - -query authCli_getDNSHostSuffix { - core_getDNSHostSuffix -} - -query authCli_getMresOutputKeyValues($msvcName: String!, $keyrefs: [ManagedResourceKeyRefIn]) { - core_getManagedResouceOutputKeyValues(msvcName: $msvcName, keyrefs: $keyrefs) { - key - mresName - value - } -} - -query authCli_getGlobalVpnDevice($gvpn: String!, $deviceName: String!) { - infra_getGlobalVPNDevice(gvpn: $gvpn, deviceName: $deviceName) { - accountName - creationTime - createdBy { - userEmail - userId - userName - } - displayName - globalVPNName - id - ipAddr - lastUpdatedBy { - userName - userId - userEmail - } - markedForDeletion - metadata { - annotations - creationTimestamp - deletionTimestamp - generation - labels - name - namespace - } - privateKey - publicKey - recordVersion - updateTime - wireguardConfig { - value - encoding - } - } -} - -query authCli_coreCheckNameAvailability($resType: ConsoleResType!, $name: String!) { - core_checkNameAvailability(resType: $resType, name: $name) { - result - suggestedNames - } -} - -query authCli_getMresKeys($name: String!, $envName: String) { - core_getManagedResouceOutputKeys(name: $name, envName: $envName) -} - -query authCli_listMreses($pq: CursorPaginationIn, $search: SearchManagedResources) { - core_listManagedResources(pq: $pq, search: $search) { - edges { - node { - displayName - metadata { - name - namespace - } - } - } - } -} - -query authCli_getMresConfigsValues($keyrefs: [ManagedResourceKeyRefIn], $envName: String) { - core_getManagedResouceOutputKeyValues(keyrefs: $keyrefs, envName: $envName) { - key - mresName - value - } -} - -query authCli_infraCheckNameAvailability($resType: ResType!, $name: String!, $clusterName: String) { - infra_checkNameAvailability( - resType: $resType - name: $name - clusterName: $clusterName - ) { - result - suggestedNames - } -} - -query authCli_getConfigSecretMap($envName: String!, $configQueries: [ConfigKeyRefIn!], $secretQueries: [SecretKeyRefIn!], $mresQueries: [SecretKeyRefIn!]) { - configs: core_getConfigValues(envName: $envName, queries: $configQueries) { - configName - key - value - } - secrets: core_getSecretValues(envName: $envName, queries: $secretQueries) { - key - secretName - value - } - mreses: core_getSecretValues(envName: $envName, queries: $mresQueries) { - key - secretName - value +query authCli_getConfigSecretMap($envName: String!, $configQueries: [ConfigKeyRefIn!], $secretQueries: [SecretKeyRefIn!], $mresQueries: [SecretKeyRefIn!]) { + configs: core_getConfigValues(envName: $envName, queries: $configQueries) { + configName + key + value + } + secrets: core_getSecretValues(envName: $envName, queries: $secretQueries) { + key + secretName + value + } + mreses: core_getSecretValues(envName: $envName, queries: $mresQueries) { + key + secretName + value } } @@ -6673,8 +5142,8 @@ mutation authAddOauthCredientials($provider: String!, $state: String!, $code: St oAuth_addLogin(provider: $provider, state: $state, code: $code) } -mutation authRequestResetPassword($email: String!) { - auth_requestResetPassword(email: $email) +mutation authRequestResetPassword($email: String!, $captchaToken: String!) { + auth_requestResetPassword(email: $email, captchaToken: $captchaToken) } mutation authResetPassword($token: String!, $password: String!) { @@ -6713,8 +5182,13 @@ mutation authLogout { auth_logout } -mutation authSignUpWithEmail($name: String!, $password: String!, $email: String!) { - auth_signup(name: $name, password: $password, email: $email) { +mutation authSignUpWithEmail($name: String!, $email: String!, $password: String!, $captchaToken: String!) { + auth_signup( + name: $name + email: $email + password: $password + captchaToken: $captchaToken + ) { id } } diff --git a/gql-queries-generator/index.ts b/gql-queries-generator/index.ts index 637f01af3..3871c74e9 100644 --- a/gql-queries-generator/index.ts +++ b/gql-queries-generator/index.ts @@ -1,7 +1,7 @@ import { GQLServerHandler as consoleHandler } from '~/console/server/gql/saved-queries'; -import { GQLServerHandler as iotconsoleHandler } from '~/iotconsole/server/gql/saved-queries'; -import { GQLServerHandler as authHandler } from '~/auth/server/gql/saved-queries'; +// import { GQLServerHandler as iotconsoleHandler } from '~/iotconsole/server/gql/saved-queries'; import fs from 'fs'; +import { GQLServerHandler as authHandler } from '~/auth/server/gql/saved-queries'; import { GQLServerHandler as libHandler } from '../lib/server/gql/saved-queries'; import { docPath, ensureDirectoryExistence, loader } from './loader'; @@ -9,7 +9,7 @@ const init = () => { ensureDirectoryExistence(docPath); const results = [ loader(consoleHandler, 'console'), - loader(iotconsoleHandler, 'iotconsole'), + // loader(iotconsoleHandler, 'iotconsole'), loader(authHandler, 'auth'), loader(libHandler, 'lib'), ]; diff --git a/lib/app-setup/root.tsx b/lib/app-setup/root.tsx index f959a4f38..9788facae 100644 --- a/lib/app-setup/root.tsx +++ b/lib/app-setup/root.tsx @@ -12,28 +12,28 @@ import { } from '@remix-run/react'; import rcSlide from 'rc-slider/assets/index.css'; import { ReactNode, useEffect } from 'react'; +import rcss from 'react-highlightjs-logs/dist/index.css'; import skeletonCSS from 'react-loading-skeleton/dist/skeleton.css'; import styleReactPulsable from 'react-pulsable/index.css'; import reactToast from 'react-toastify/dist/ReactToastify.css'; -import rcss from 'react-highlightjs-logs/dist/index.css'; +import { Button } from '~/components/atoms/button'; import Container from '~/components/atoms/container'; import ProgressContainer, { useProgress, } from '~/components/atoms/progress-bar'; import Tooltip from '~/components/atoms/tooltip'; +import { TooltipContainer } from '~/components/atoms/tooltipV2'; import { BrandLogo } from '~/components/branding/brand-logo'; import { ToastContainer } from '~/components/molecule/toast'; +import Page404 from '~/components/organisms/page-404'; import { TopBar } from '~/components/organisms/top-bar'; +import { ChildrenProps } from '~/components/types'; import stylesUrl from '~/design-system/index.css'; import tailwindBase from '~/design-system/tailwind-base.js'; import { ReloadIndicator } from '~/lib/client/components/reload-indicator'; import { isDev } from '~/lib/client/helpers/log'; -import { Button } from '~/components/atoms/button'; -import { ChildrenProps } from '~/components/types'; -import Page404 from '~/components/organisms/page-404'; import { getClientEnv, getServerEnv } from '~/root/lib/configs/base-url.cjs'; import { useDataFromMatches } from '../client/hooks/use-custom-matches'; -import { TooltipContainer } from '~/components/atoms/tooltipV2'; export const links: LinksFunction = () => [ { rel: 'stylesheet', href: stylesUrl }, diff --git a/lib/app-setup/with-contxt.ts b/lib/app-setup/with-contxt.ts index e6452df0a..d0ec032d3 100644 --- a/lib/app-setup/with-contxt.ts +++ b/lib/app-setup/with-contxt.ts @@ -1,11 +1,11 @@ import { redirect } from 'react-router-dom'; import { IExtRemixCtx, MapType } from '../types/common'; -const withContext = ( +const withContext = ( ctx: IExtRemixCtx, - props: MapType, + props: T, headers: MapType = {} -) => { +): T => { let _props = props; if (ctx.authProps) { @@ -23,7 +23,7 @@ const withContext = ( 'set-cookie': [...(ctx.request.cookies || [])].join('; '), ...headers, }, - }); + }) as T; }; export const redirectWithContext = ( diff --git a/src/apps/auth/routes/_main+/forgot-password.tsx b/src/apps/auth/routes/_main+/forgot-password.tsx index 6f3422743..f8d688643 100644 --- a/src/apps/auth/routes/_main+/forgot-password.tsx +++ b/src/apps/auth/routes/_main+/forgot-password.tsx @@ -1,16 +1,16 @@ +import { Link } from '@remix-run/react'; +import { RECAPTCHA_SITE_KEY } from '~/auth/consts'; +import { useAuthApi } from '~/auth/server/gql/api-provider'; import { Button } from '~/components/atoms/button'; import { TextInput } from '~/components/atoms/input'; -import { Link } from '@remix-run/react'; -import useForm from '~/root/lib/client/hooks/use-form'; -import Yup from '~/root/lib/server/helpers/yup'; +import { ArrowRight } from '~/components/icons'; import { toast } from '~/components/molecule/toast'; import { cn } from '~/components/utils'; +import grecaptcha from '~/root/lib/client/helpers/g-recaptcha'; +import useForm from '~/root/lib/client/hooks/use-form'; +import Yup from '~/root/lib/server/helpers/yup'; import { handleError } from '~/root/lib/utils/common'; -import { useAuthApi } from '~/auth/server/gql/api-provider'; -import { ArrowRight } from '~/components/icons'; import Container from '../../components/container'; -import grecaptcha from '~/root/lib/client/helpers/g-recaptcha'; -import { RECAPTCHA_SITE_KEY } from '~/auth/consts'; const ForgetPassword = () => { const api = useAuthApi(); @@ -28,8 +28,8 @@ const ForgetPassword = () => { }); const { errors: e } = await api.requestResetPassword({ email: val.email, - //@ts-ignore - token, + // @ts-ignore + captchaToken: token, }); if (e) { throw e[0]; diff --git a/src/apps/auth/routes/_providers+/signup.tsx b/src/apps/auth/routes/_providers+/signup.tsx index 72e9f8b60..814893956 100644 --- a/src/apps/auth/routes/_providers+/signup.tsx +++ b/src/apps/auth/routes/_providers+/signup.tsx @@ -1,4 +1,3 @@ -import { Button } from '~/components/atoms/button.jsx'; import { Envelope, GithubLogoFill, @@ -6,23 +5,24 @@ import { GoogleLogo, } from '@jengaicons/react'; import { - useSearchParams, Link, useNavigate, useOutletContext, + useSearchParams, } from '@remix-run/react'; -import { TextInput, PasswordInput } from '~/components/atoms/input.jsx'; -import useForm from '~/root/lib/client/hooks/use-form'; -import Yup from '~/root/lib/server/helpers/yup'; +import { RECAPTCHA_SITE_KEY, mainUrl } from '~/auth/consts'; +import { Button } from '~/components/atoms/button.jsx'; +import { PasswordInput, TextInput } from '~/components/atoms/input.jsx'; +import { ArrowLeft, ArrowRight } from '~/components/icons'; import { toast } from '~/components/molecule/toast'; +import { cn } from '~/components/utils'; +import grecaptcha from '~/root/lib/client/helpers/g-recaptcha'; import { useAPIClient } from '~/root/lib/client/hooks/api-provider'; +import useForm from '~/root/lib/client/hooks/use-form'; +import Yup from '~/root/lib/server/helpers/yup'; import { handleError } from '~/root/lib/utils/common'; -import { ArrowLeft, ArrowRight } from '~/components/icons'; -import { cn } from '~/components/utils'; -import { RECAPTCHA_SITE_KEY, mainUrl } from '~/auth/consts'; import Container from '../../components/container'; import { IProviderContext } from './_layout'; -import grecaptcha from '~/root/lib/client/helpers/g-recaptcha'; const CustomGoogleIcon = (props: any) => { return ; @@ -55,7 +55,7 @@ const SignUpWithEmail = () => { email: v.email, name: v.name, password: v.password, - token, + captchaToken: token, }); if (_errors) { throw _errors[0]; diff --git a/src/apps/auth/server/gql/saved-queries.ts b/src/apps/auth/server/gql/saved-queries.ts index ccab30de7..50eb58b3c 100644 --- a/src/apps/auth/server/gql/saved-queries.ts +++ b/src/apps/auth/server/gql/saved-queries.ts @@ -3,6 +3,8 @@ import { ExecuteQueryWithContext } from '~/root/lib/server/helpers/execute-query import { IGQLServerProps } from '~/root/lib/types/common'; import { AuthAddOauthCredientialsMutation, + AuthCheckOauthEnabledQuery, + AuthCheckOauthEnabledQueryVariables, AuthLoginMutation, AuthLoginMutationVariables, AuthLoginPageInitUrlsQuery, @@ -13,20 +15,18 @@ import { AuthOauthLoginMutationVariables, AuthRequestResetPasswordMutation, AuthRequestResetPasswordMutationVariables, + AuthResendVerificationEmailMutation, + AuthResendVerificationEmailMutationVariables, AuthResetPasswordMutation, AuthResetPasswordMutationVariables, + AuthSetRemoteAuthHeaderMutation, + AuthSetRemoteAuthHeaderMutationVariables, AuthSignUpWithEmailMutation, AuthSignUpWithEmailMutationVariables, AuthVerifyEmailMutation, AuthVerifyEmailMutationVariables, AuthWhoAmIQuery, AuthWhoAmIQueryVariables, - AuthCheckOauthEnabledQuery, - AuthCheckOauthEnabledQueryVariables, - AuthSetRemoteAuthHeaderMutation, - AuthSetRemoteAuthHeaderMutationVariables, - AuthResendVerificationEmailMutation, - AuthResendVerificationEmailMutationVariables, } from '~/root/src/generated/gql/server'; import { cliQueries } from './cli-queries'; @@ -48,7 +48,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { transformer(data: AuthSetRemoteAuthHeaderMutation) { return data.auth_setRemoteAuthHeader; }, - vars(_: AuthSetRemoteAuthHeaderMutationVariables) {}, + vars(_: AuthSetRemoteAuthHeaderMutationVariables) { }, } ), @@ -65,7 +65,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { transformer(data: AuthCheckOauthEnabledQuery) { return data.auth_listOAuthProviders; }, - vars(_: AuthCheckOauthEnabledQueryVariables) {}, + vars(_: AuthCheckOauthEnabledQueryVariables) { }, } ), addOauthCredientials: executor( @@ -78,20 +78,23 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { transformer(data: AuthAddOauthCredientialsMutation) { return data.oAuth_addLogin; }, - vars(_: AuthOauthLoginMutationVariables) {}, + vars(_: AuthOauthLoginMutationVariables) { }, } ), requestResetPassword: executor( gql` - mutation Auth_requestResetPassword($email: String!) { - auth_requestResetPassword(email: $email) + mutation Auth_requestResetPassword( + $email: String! + $captchaToken: String! + ) { + auth_requestResetPassword(email: $email, captchaToken: $captchaToken) } `, { transformer: (data: AuthRequestResetPasswordMutation) => data.auth_requestResetPassword, - vars(_: AuthRequestResetPasswordMutationVariables) {}, + vars(_: AuthRequestResetPasswordMutationVariables) { }, } ), @@ -107,7 +110,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { { transformer: (data: AuthResetPasswordMutation) => data.auth_resetPassword, - vars(_: AuthResetPasswordMutationVariables) {}, + vars(_: AuthResetPasswordMutationVariables) { }, } ), @@ -122,7 +125,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { { transformer: (data: AuthOauthLoginMutation) => data.oAuth_login, - vars(_: AuthOauthLoginMutationVariables) {}, + vars(_: AuthOauthLoginMutationVariables) { }, } ), @@ -136,7 +139,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { `, { transformer: (data: AuthVerifyEmailMutation) => data.auth_verifyEmail, - vars(_: AuthVerifyEmailMutationVariables) {}, + vars(_: AuthVerifyEmailMutationVariables) { }, } ), @@ -149,7 +152,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { { transformer: (data: AuthResendVerificationEmailMutation) => data.auth_resendVerificationEmail, - vars(_: AuthResendVerificationEmailMutationVariables) {}, + vars(_: AuthResendVerificationEmailMutationVariables) { }, } ), @@ -163,7 +166,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { `, { transformer: (data: AuthLoginPageInitUrlsQuery) => data, - vars(_: AuthLoginPageInitUrlsQueryVariables) {}, + vars(_: AuthLoginPageInitUrlsQueryVariables) { }, } ), @@ -177,7 +180,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { `, { transformer: (data: AuthLoginMutation) => data.auth_login, - vars(_: AuthLoginMutationVariables) {}, + vars(_: AuthLoginMutationVariables) { }, } ), @@ -189,7 +192,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { `, { transformer: (data: AuthLogoutMutation) => data.auth_logout, - vars(_: AuthLogoutMutationVariables) {}, + vars(_: AuthLogoutMutationVariables) { }, } ), @@ -197,17 +200,23 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { gql` mutation Auth_signup( $name: String! - $password: String! $email: String! + $password: String! + $captchaToken: String! ) { - auth_signup(name: $name, password: $password, email: $email) { + auth_signup( + name: $name + email: $email + password: $password + captchaToken: $captchaToken + ) { id } } `, { transformer: (data: AuthSignUpWithEmailMutation) => data.auth_signup, - vars(_: AuthSignUpWithEmailMutationVariables) {}, + vars(_: AuthSignUpWithEmailMutationVariables) { }, } ), @@ -225,7 +234,7 @@ export const GQLServerHandler = ({ headers, cookies }: IGQLServerProps) => { `, { transformer: (data: AuthWhoAmIQuery) => data.auth_me, - vars(_: AuthWhoAmIQueryVariables) {}, + vars(_: AuthWhoAmIQueryVariables) { }, } ), }; diff --git a/src/apps/console/components/console-list-components.tsx b/src/apps/console/components/console-list-components.tsx index 79ca1a38d..b6cdbd598 100644 --- a/src/apps/console/components/console-list-components.tsx +++ b/src/apps/console/components/console-list-components.tsx @@ -157,7 +157,7 @@ const ListItemV2 = ({
{data} @@ -177,7 +177,7 @@ const ListItemV2 = ({
{data.length >= truncateLength ? ( @@ -341,12 +341,8 @@ const listClass = { item: 'w-[146px]', }; export { - ListBody, - ListItem, - ListTitle, - ListTitleV2, - ListItemV2, - ListSecondary, - listFlex, - listClass, + ListBody, listClass, listFlex, ListItem, ListItemV2, + ListSecondary, ListTitle, + ListTitleV2 }; + diff --git a/src/apps/console/components/icons.tsx b/src/apps/console/components/icons.tsx index ebabba279..9012767e9 100644 --- a/src/apps/console/components/icons.tsx +++ b/src/apps/console/components/icons.tsx @@ -138,4 +138,5 @@ export { Play, Pause, Dockerlogo, + Note, } from '@jengaicons/react'; diff --git a/src/apps/console/components/multi-step-progress.tsx b/src/apps/console/components/multi-step-progress.tsx index 438e5f5ce..cc8def773 100644 --- a/src/apps/console/components/multi-step-progress.tsx +++ b/src/apps/console/components/multi-step-progress.tsx @@ -1,6 +1,6 @@ -import { Check } from '~/console/components/icons'; import React, { Children, ReactElement, ReactNode, useState } from 'react'; import { cn } from '~/components/utils'; +import { Check } from '~/console/components/icons'; interface IUseMultiStepProgress { defaultStep: number; @@ -50,6 +50,7 @@ type IProgressTrackerItem = { noJump?: (step: number) => boolean; editable?: boolean; step: number; + hasPages?: boolean; }; function ProgressTrackerItem( @@ -65,7 +66,18 @@ function ProgressTrackerItem( noJump, editable, step, + hasPages, } = props; + + if (!hasPages) { + return ( +
+ {label} + {children} +
+ ); + } + return (
void; noJump?: (step: number) => boolean; editable?: boolean; + hasPages?: boolean; } const Root = ({ children, @@ -150,6 +163,7 @@ const Root = ({ jumpStep, noJump, editable = true, + hasPages = true, }: IMultiStepProgress) => { let child = children; // @ts-ignore @@ -171,6 +185,7 @@ const Root = ({ noJump={noJump || (() => !(index + 1 < currentStep))} editable={editable} completed={currentStep > ch.props.step} + hasPages={hasPages} onClick={() => { if (noJump ? !noJump?.(ch.props.step) : index + 1 < currentStep) { jumpStep(index + 1); diff --git a/src/apps/console/components/template-avatar.tsx b/src/apps/console/components/template-avatar.tsx new file mode 100644 index 000000000..db4e79d08 --- /dev/null +++ b/src/apps/console/components/template-avatar.tsx @@ -0,0 +1,24 @@ +import { Avatar } from '~/components/atoms/avatar'; +import { titleCase } from '~/components/utils'; +import generateColor from '~/root/lib/utils/color-generator'; + +const TemplateAvatar = ({ + name, + color, + size, +}: { + name: string; + color?: string; + size?: string; +}) => { + return ( + {titleCase(name)}} + isTemplate + /> + ); +}; + +export default TemplateAvatar; diff --git a/src/apps/console/page-components/handle-environment.tsx b/src/apps/console/page-components/handle-environment.tsx index 8023dc190..5b7b7c6d4 100644 --- a/src/apps/console/page-components/handle-environment.tsx +++ b/src/apps/console/page-components/handle-environment.tsx @@ -1,7 +1,10 @@ +/* eslint-disable no-nested-ternary */ import { useCallback, useEffect, useState } from 'react'; +import Radio from '~/components/atoms/radio'; import Select from '~/components/atoms/select'; import Popup from '~/components/molecule/popup'; import { toast } from '~/components/molecule/toast'; +import { cn } from '~/components/utils'; import { useReload } from '~/root/lib/client/helpers/reloader'; import useForm, { dummyEvent } from '~/root/lib/client/hooks/use-form'; import Yup from '~/root/lib/server/helpers/yup'; @@ -14,18 +17,28 @@ import { IEnvironment } from '../server/gql/queries/environment-queries'; import { parseName, parseNodes } from '../server/r-utils/common'; import { DIALOG_TYPE } from '../utils/commons'; -const ClusterSelectItem = ({ +export const ClusterSelectItem = ({ label, value, + disabled, }: { label: string; value: string; + disabled?: boolean; }) => { return ( -
+
-
{label}
-
{value}
+
+ {label} +
+
+ {value} +
); @@ -53,8 +66,13 @@ const HandleEnvironment = ({ show, setShow }: IDialog) => { label: c.displayName, value: parseName(c), ready: findClusterStatus(c), + disabled: !findClusterStatus(c), render: () => ( - + ), })); setClusterList(data); @@ -71,7 +89,7 @@ const HandleEnvironment = ({ show, setShow }: IDialog) => { Yup.object({ displayName: Yup.string().required(), name: Yup.string().required(), - clusterName: Yup.string().required(), + // clusterName: Yup.string().required(), }) ); @@ -88,6 +106,7 @@ const HandleEnvironment = ({ show, setShow }: IDialog) => { name: '', displayName: '', clusterName: '', + radioType: 'compute', environmentRoutingMode: false, isNameError: false, }, @@ -101,7 +120,8 @@ const HandleEnvironment = ({ show, setShow }: IDialog) => { metadata: { name: val.name, }, - clusterName: val.clusterName || '', + clusterName: + val.radioType === 'template' ? '' : val.clusterName || '', displayName: val.displayName, spec: { routing: { @@ -159,7 +179,9 @@ const HandleEnvironment = ({ show, setShow }: IDialog) => { > {show?.type === DIALOG_TYPE.ADD - ? `Create new environment` + ? values.radioType === 'compute' + ? `Create new environment` + : `Create new template` : `Edit environment`} ) => { isUpdate={show?.type !== DIALOG_TYPE.ADD} /> - clusterList} + onChange={({ value }) => { + handleChange('clusterName')(dummyEvent(value)); + }} + error={!!errors.clusterName} + message={errors.clusterName} + /> + )} {/* { const api = useConsoleApi(); const navigate = useNavigate(); const user = useDataFromMatches('user', {}); + // const { a: accountName } = useParams(); + const { data: accountsData } = useCustomSwr('/list_accounts', async () => { return api.listAccounts({}); }); @@ -72,8 +74,13 @@ const NewAccount = () => { if (_errors) { throw _errors[0]; } + // const { errors: e } = await api.setupDefaultEnvironment({}); + // if (e) { + // throw e[0]; + // } toast.success('account created'); - navigate(`/onboarding/${v.name}/attach-new-cluster`); + // navigate(`/onboarding/${v.name}/attach-new-cluster`); + navigate(`/${v.name}/environments`); } catch (err) { handleError(err); } @@ -109,13 +116,14 @@ const NewAccount = () => { {...(accountsData?.length === 0 ? {} : { - backButton: { - content: 'Back to teams', - to: `/teams`, - }, - })} + backButton: { + content: 'Back to teams', + to: `/teams`, + }, + })} > true} @@ -150,7 +158,7 @@ const NewAccount = () => { { {/* */} {/* */} - + {/* + /> */} diff --git a/src/apps/console/routes/_main+/$account+/_layout.tsx b/src/apps/console/routes/_main+/$account+/_layout.tsx index 800590cb0..68b55c13d 100644 --- a/src/apps/console/routes/_main+/$account+/_layout.tsx +++ b/src/apps/console/routes/_main+/$account+/_layout.tsx @@ -1,10 +1,3 @@ -import { - Buildings, - Check, - ChevronUpDown, - Plus, - Search, -} from '~/console/components/icons'; import { redirect } from '@remix-run/node'; import { Link, @@ -17,9 +10,16 @@ import { } from '@remix-run/react'; import { ReactNode, useEffect, useRef, useState } from 'react'; import Popup from '~/components/molecule/popup'; +import { + Buildings, + Check, + ChevronUpDown, + Plus, + Search, +} from '~/console/components/icons'; import { useDataFromMatches } from '~/root/lib/client/hooks/use-custom-matches'; import { useUnsavedChanges } from '~/root/lib/client/hooks/use-unsaved-changes'; -import { IRemixCtx, LoaderResult } from '~/root/lib/types/common'; +import { IExtRemixCtx, LoaderResult } from '~/root/lib/types/common'; import { IAccount, @@ -31,29 +31,30 @@ import { parseNodes, } from '~/console/server/r-utils/common'; +import { Button } from '~/components/atoms/button'; +import OptionList from '~/components/atoms/option-list'; +import { cn } from '~/components/utils'; +import MenuSelect, { SelectItem } from '~/console/components/menu-select'; +import { useClusterStatusV2 } from '~/console/hooks/use-cluster-status-v2'; +import { useConsoleApi } from '~/console/server/gql/api-provider'; +import { IByocClusters } from '~/console/server/gql/queries/byok-cluster-queries'; +import { IMSvTemplates } from '~/console/server/gql/queries/managed-templates-queries'; +import { GQLServerHandler } from '~/console/server/gql/saved-queries'; import { ensureAccountClientSide, ensureAccountSet, } from '~/console/server/utils/auth-utils'; -import { GQLServerHandler } from '~/console/server/gql/saved-queries'; -import MenuSelect, { SelectItem } from '~/console/components/menu-select'; import { BreadcrumButtonContent, BreadcrumSlash, } from '~/console/utils/commons'; -import OptionList from '~/components/atoms/option-list'; -import { Button } from '~/components/atoms/button'; -import { useConsoleApi } from '~/console/server/gql/api-provider'; -import { handleError } from '~/root/lib/utils/common'; -import { cn } from '~/components/utils'; -import useCustomSwr from '~/root/lib/client/hooks/use-custom-swr'; +import withContext from '~/root/lib/app-setup/with-contxt'; import { useSearch } from '~/root/lib/client/helpers/search-filter'; -import { IMSvTemplates } from '~/console/server/gql/queries/managed-templates-queries'; -import { IByocClusters } from '~/console/server/gql/queries/byok-cluster-queries'; +import useCustomSwr from '~/root/lib/client/hooks/use-custom-swr'; +import { handleError } from '~/root/lib/utils/common'; import { IConsoleRootContext } from '../_layout/_layout'; -import { useClusterStatusV2 } from '~/console/hooks/use-cluster-status-v2'; -export const loader = async (ctx: IRemixCtx) => { +export const loader = async (ctx: IExtRemixCtx) => { const { account } = ctx.params; let acccountData: IAccount; @@ -67,14 +68,14 @@ export const loader = async (ctx: IRemixCtx) => { } const { data: msvTemplates, errors: msvError } = await GQLServerHandler( - ctx.request, + ctx.request ).listMSvTemplates({}); if (msvError) { throw msvError[0]; } const { data: clusterList, errors: clusterError } = await GQLServerHandler( - ctx.request, + ctx.request ).listByokClusters({ pagination: { first: 100, @@ -85,20 +86,18 @@ export const loader = async (ctx: IRemixCtx) => { throw clusterError[0]; } - const cMaps = parseNodes(clusterList).reduce( - (acc, c) => { - acc[c.metadata.name] = c; - return acc; - }, - {} as { [key: string]: ExtractNodeType }, - ); + const cMaps = parseNodes(clusterList).reduce((acc, c) => { + acc[c.metadata.name] = c; + return acc; + }, {} as { [key: string]: ExtractNodeType }); acccountData = data; - return { + + return withContext(ctx, { msvtemplates: msvTemplates, account: data, clustersMap: cMaps, - }; + }); } catch (err) { handleError(err); const k = redirect('/teams') as any; @@ -382,7 +381,7 @@ const CurrentBreadcrum = ({ account }: { account: IAccount }) => { const { data: accounts } = useCustomSwr( () => '/accounts', - async () => api.listAccounts({}), + async () => api.listAccounts({}) ); const [searchText, setSearchText] = useState(''); @@ -399,7 +398,7 @@ const CurrentBreadcrum = ({ account }: { account: IAccount }) => { searchText, keys: ['searchField'], }, - [searchText, accounts], + [searchText, accounts] ); const [open, setOpen] = useState(false); @@ -434,7 +433,7 @@ const CurrentBreadcrum = ({ account }: { account: IAccount }) => { aria-label="accounts" className={cn( 'outline-none rounded py-lg px-md mx-md bg-surface-basic-hovered', - open || isMouseOver ? 'bg-surface-basic-pressed' : '', + open || isMouseOver ? 'bg-surface-basic-pressed' : '' )} onMouseOver={() => { setIsMouseOver(true); @@ -482,7 +481,7 @@ const CurrentBreadcrum = ({ account }: { account: IAccount }) => { 'flex flex-row items-center justify-between', parseName(item) === parseName(account) ? 'bg-surface-basic-pressed hover:!bg-surface-basic-pressed' - : '', + : '' )} > {item.displayName} diff --git a/src/apps/console/routes/_main+/$account+/environments/clone-environment.tsx b/src/apps/console/routes/_main+/$account+/environments/clone-environment.tsx index 9aea5a6c1..2a82309e7 100644 --- a/src/apps/console/routes/_main+/$account+/environments/clone-environment.tsx +++ b/src/apps/console/routes/_main+/$account+/environments/clone-environment.tsx @@ -7,6 +7,7 @@ import CommonPopupHandle from '~/console/components/common-popup-handle'; import { NameIdView } from '~/console/components/name-id-view'; import { IDialogBase } from '~/console/components/types.d'; import { findClusterStatus } from '~/console/hooks/use-cluster-status'; +import { ClusterSelectItem } from '~/console/page-components/handle-environment'; import { useConsoleApi } from '~/console/server/gql/api-provider'; import { IEnvironments } from '~/console/server/gql/queries/environment-queries'; import { @@ -21,22 +22,22 @@ import { handleError } from '~/root/lib/utils/common'; type IDialog = IDialogBase>; -const ClusterSelectItem = ({ - label, - value, -}: { - label: string; - value: string; -}) => { - return ( -
-
-
{label}
-
{value}
-
-
- ); -}; +// const ClusterSelectItem = ({ +// label, +// value, +// }: { +// label: string; +// value: string; +// }) => { +// return ( +//
+//
+//
{label}
+//
{value}
+//
+//
+// ); +// }; const Root = (props: IDialog) => { const { isUpdate, setVisible } = props; @@ -52,8 +53,13 @@ const Root = (props: IDialog) => { label: c.displayName, value: parseName(c), ready: findClusterStatus(c), + disabled: !findClusterStatus(c), render: () => ( - + ), })); setClusterList(data); @@ -150,13 +156,14 @@ const Root = (props: IDialog) => { size="lg" value={values.clusterName} placeholder="Select a Cluster" - options={async () => [ - ...((clusterList && - clusterList.filter((d) => { - return d.ready; - })) || - []), - ]} + options={async () => clusterList} + // options={async () => [ + // ...((clusterList && + // clusterList.filter((d) => { + // return d.ready; + // })) || + // []), + // ]} onChange={({ value }) => { handleChange('clusterName')(dummyEvent(value)); }} diff --git a/src/apps/console/routes/_main+/$account+/environments/environment-resources-v2.tsx b/src/apps/console/routes/_main+/$account+/environments/environment-resources-v2.tsx index 0fe3a7882..eb5b42227 100644 --- a/src/apps/console/routes/_main+/$account+/environments/environment-resources-v2.tsx +++ b/src/apps/console/routes/_main+/$account+/environments/environment-resources-v2.tsx @@ -1,5 +1,5 @@ import { Link, useOutletContext, useParams } from '@remix-run/react'; -import { useEffect, useState } from 'react'; +import { useState } from 'react'; import { Badge } from '~/components/atoms/badge'; import { toast } from '~/components/molecule/toast'; import { generateKey, titleCase } from '~/components/utils'; @@ -20,6 +20,7 @@ import ResourceExtraAction, { IResourceExtraItem, } from '~/console/components/resource-extra-action'; import { SyncStatusV2 } from '~/console/components/sync-status'; +import TemplateAvatar from '~/console/components/template-avatar'; import { findClusterStatus } from '~/console/hooks/use-cluster-status'; import { useClusterStatusV2 } from '~/console/hooks/use-cluster-status-v2'; import { IAccountContext } from '~/console/routes/_main+/$account+/_layout'; @@ -253,17 +254,35 @@ const ListView = ({ items, onAction }: IResource) => { } + avatar={ + i.clusterName === '' ? ( + // + + ) : ( + + ) + } /> ), }, cluster: { - render: () => ( - - ), + render: () => { + if (i.clusterName === '') { + return ; + } + return ( + + ); + }, }, status: { render: () => { + if (i.clusterName === '') { + // return TEMPLATE; + // return ; + return ; + } + if (i.isArchived) { return Archived; } @@ -312,7 +331,7 @@ const EnvironmentResourcesV2 = ({ items = [] }: { items: BaseType[] }) => { useWatchReload( items.map((i) => { return `account:${parseName(account)}.environment:${parseName(i)}`; - }), + }) ); const suspendEnvironment = async (item: BaseType, suspend: boolean) => { @@ -334,11 +353,10 @@ const EnvironmentResourcesV2 = ({ items = [] }: { items: BaseType[] }) => { throw errors[0]; } toast.success( - `${ - suspend - ? 'Environment suspended successfully' - : 'Environment resumed successfully' - }`, + `${suspend + ? 'Environment suspended successfully' + : 'Environment resumed successfully' + }` ); reloadPage(); } catch (err) { @@ -347,7 +365,7 @@ const EnvironmentResourcesV2 = ({ items = [] }: { items: BaseType[] }) => { }; const [showDeleteDialog, setShowDeleteDialog] = useState( - null, + null ); const [visible, setVisible] = useState(null); diff --git a/src/apps/console/routes/_main+/$account+/environments/route.tsx b/src/apps/console/routes/_main+/$account+/environments/route.tsx index afecc7765..768c7a2e4 100644 --- a/src/apps/console/routes/_main+/$account+/environments/route.tsx +++ b/src/apps/console/routes/_main+/$account+/environments/route.tsx @@ -1,5 +1,5 @@ import { defer } from '@remix-run/node'; -import { Link, useLoaderData, useParams } from '@remix-run/react'; +import { useLoaderData } from '@remix-run/react'; import { useState } from 'react'; import { Button } from '~/components/atoms/button.jsx'; import { Plus } from '~/console/components/icons'; @@ -30,16 +30,16 @@ export const loader = async (ctx: IRemixCtx) => { search: getSearch(ctx), }); - const { data: clusterData, errors: clusterErrors } = await GQLServerHandler( - ctx.request - ).listAllClusters({ - pagination: getPagination(ctx), - search: getSearch(ctx), - }); + // const { data: clusterData, errors: clusterErrors } = await GQLServerHandler( + // ctx.request + // ).listAllClusters({ + // pagination: getPagination(ctx), + // search: getSearch(ctx), + // }); - if (clusterErrors) { - throw clusterErrors[0]; - } + // if (clusterErrors) { + // throw clusterErrors[0]; + // } if (errors) { throw errors[0]; @@ -47,7 +47,7 @@ export const loader = async (ctx: IRemixCtx) => { return { environmentData: data || {}, - clusterList: clusterData || {}, + // clusterList: clusterData || {}, }; }); @@ -59,7 +59,7 @@ const Workspaces = () => { useState>(null); const { promise } = useLoaderData(); - const { account } = useParams(); + // const { account } = useParams(); return ( <> @@ -68,64 +68,62 @@ const Workspaces = () => { skeletonData={{ environmentData: fake.ConsoleListEnvironmentsQuery .core_listEnvironments as any, - clusterList: fake.ConsoleListAllClustersQuery.byok_clusters as any, }} > - {({ environmentData, clusterList }) => { + {({ environmentData }) => { const environments = parseNodes(environmentData); - const clusters = parseNodes(clusterList); if (!environments) { return null; } - if (clusters?.length === 0) { - return ( - , - is: environments?.length === 0, - title: 'This is where you’ll manage your environment.', - content: ( -

- You don't have any compute attached to your account. - Please attach a compute to your account to create an - environment. -
- Go to{' '} - - - Infrastructure - - {' '} - to attach your compute or local device. -

- /*