Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: migrate the repository store to v1 (#6390)

ecmadao10c465b4fee9
diff --git a/backend/api/v1/common.go b/backend/api/v1/common.go
index fd61b37408..eea1d7d6e3 100644
--- a/backend/api/v1/common.go
+++ b/backend/api/v1/common.go
@@ -243,9 +243,9 @@ func getExternalVersionControlID(name string) (int, error) {
if err != nil {
return 0, err
}
- externalVersionControlID, err := strconv.Atoi(tokens[1])
+ externalVersionControlID, err := strconv.Atoi(tokens[0])
if err != nil {
- return 0, errors.Errorf("invalid external version control ID %q", tokens[1])
+ return 0, errors.Errorf("invalid external version control ID %q", tokens[0])
}
return externalVersionControlID, nil
}
diff --git a/backend/api/v1/externalvs_service.go b/backend/api/v1/externalvs_service.go
index b7f1fdb741..91c7da80dc 100644
--- a/backend/api/v1/externalvs_service.go
+++ b/backend/api/v1/externalvs_service.go
@@ -12,6 +12,7 @@ import (
"github.com/pkg/errors"
"github.com/bytebase/bytebase/backend/common"
+ api "github.com/bytebase/bytebase/backend/legacyapi"
"github.com/bytebase/bytebase/backend/plugin/vcs"
"github.com/bytebase/bytebase/backend/store"
v1pb "github.com/bytebase/bytebase/proto/generated-go/v1"
@@ -181,8 +182,26 @@ func (s *ExternalVersionControlService) SearchExternalVersionControlProjects(ctx
}
// ListProjectGitOpsInfo lists GitOps info of a project.
-func (*ExternalVersionControlService) ListProjectGitOpsInfo(context.Context, *v1pb.ListProjectGitOpsInfoRequest) (*v1pb.ListProjectGitOpsInfoResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method ListProjectGitOpsInfo not implemented")
+func (s *ExternalVersionControlService) ListProjectGitOpsInfo(ctx context.Context, request *v1pb.ListProjectGitOpsInfoRequest) (*v1pb.ListProjectGitOpsInfoResponse, error) {
+ externalVersionControlUID, err := getExternalVersionControlID(request.Name)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ }
+
+ repositoryFind := &api.RepositoryFind{
+ VCSID: &externalVersionControlUID,
+ }
+ repoList, err := s.store.FindRepository(ctx, repositoryFind)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to fetch external repository list: %v", err)
+ }
+
+ resp := &v1pb.ListProjectGitOpsInfoResponse{}
+ for _, repo := range repoList {
+ resp.ProjectGitopsInfo = append(resp.ProjectGitopsInfo, convertToProjectGitOpsInfo(fmt.Sprintf("%s%s", projectNamePrefix, repo.Project.ResourceID), repo))
+ }
+
+ return resp, nil
}
func convertToExternalVersionControls(externalVersionControls []*store.ExternalVersionControlMessage) []*v1pb.ExternalVersionControl {
diff --git a/frontend/src/components/RepositoryTable.vue b/frontend/src/components/RepositoryTable.vue
index 37e6c649b5..1b1ab7f77b 100644
--- a/frontend/src/components/RepositoryTable.vue
+++ b/frontend/src/components/RepositoryTable.vue
@@ -9,59 +9,43 @@
>
<template #body="{ rowData: repository }">
<BBTableCell :left-padding="4" class="w-16">
- {{ projectName(repository.project) }}
+ {{ projectV1Name(repository.project) }}
</BBTableCell>
<BBTableCell class="w-32">
{{ repository.fullPath }}
</BBTableCell>
- <BBTableCell class="w-16">
- {{ humanizeTs(repository.createdTs) }}
- </BBTableCell>
</template>
</BBTable>
</template>
-<script lang="ts">
-import { computed, defineComponent, PropType } from "vue";
+<script lang="ts" setup>
+import { computed, PropType } from "vue";
import { useRouter } from "vue-router";
-import { projectSlug } from "../utils";
-import { Repository } from "../types";
+import { projectSlugV1, projectV1Name } from "../utils";
import { useI18n } from "vue-i18n";
+import { ComposedRepository } from "@/types";
-export default defineComponent({
- name: "RepositoryTable",
- props: {
- repositoryList: {
- required: true,
- type: Object as PropType<Repository[]>,
- },
+const props = defineProps({
+ repositoryList: {
+ required: true,
+ type: Object as PropType<ComposedRepository[]>,
},
- setup(props) {
- const { t } = useI18n();
-
- const router = useRouter();
-
- const columnList = computed(() => [
- {
- title: t("common.project"),
- },
- {
- title: t("common.repository"),
- },
- {
- title: t("common.created-at"),
- },
- ]);
+});
+const { t } = useI18n();
- const clickRepository = function (section: number, row: number) {
- const repository = props.repositoryList[row];
- router.push(`/project/${projectSlug(repository.project)}#gitops`);
- };
+const router = useRouter();
- return {
- columnList,
- clickRepository,
- };
+const columnList = computed(() => [
+ {
+ title: t("common.project"),
},
-});
+ {
+ title: t("common.repository"),
+ },
+]);
+
+const clickRepository = function (_: number, row: number) {
+ const repository = props.repositoryList[row];
+ router.push(`/project/${projectSlugV1(repository.project)}#gitops`);
+};
</script>
diff --git a/frontend/src/components/SQLReview/SQLReviewInfo.vue b/frontend/src/components/SQLReview/SQLReviewInfo.vue
index ecf3067da8..bdf5e79043 100644
--- a/frontend/src/components/SQLReview/SQLReviewInfo.vue
+++ b/frontend/src/components/SQLReview/SQLReviewInfo.vue
@@ -19,7 +19,7 @@
/>
<BBTextField
class="mt-2 w-full"
- :value="environmentTitleV1(selectedEnvironment)"
+ :value="environmentV1Name(selectedEnvironment)"
:disabled="true"
/>
</div>
@@ -54,7 +54,7 @@
<script lang="ts" setup>
import { PropType } from "vue";
import { SQLReviewPolicyTemplate } from "@/types";
-import { environmentTitleV1 } from "@/utils";
+import { environmentV1Name } from "@/utils";
import { BBTextField } from "@/bbkit";
import { SQLReviewTemplateSelector } from "./components";
import { Environment } from "@/types/proto/v1/environment_service";
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.ts
index 035c3629b7..3afb8bf8f0 100644
--- a/frontend/src/grpcweb/index.ts
+++ b/frontend/src/grpcweb/index.ts
@@ -20,6 +20,7 @@ import { InstanceRoleServiceDefinition } from "@/types/proto/v1/instance_role_se
import { CelServiceDefinition } from "@/types/proto/v1/cel_service";
import { SubscriptionServiceDefinition } from "@/types/proto/v1/subscription_service";
import { ActuatorServiceDefinition } from "@/types/proto/v1/actuator_service";
+import { ExternalVersionControlServiceDefinition } from "@/types/proto/v1/externalvs_service";
// Create each grpc service client.
// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md
@@ -121,6 +122,11 @@ export const actuatorServiceClient = clientFactory.create(
channel
);
+export const externalVersionControlServiceClient = clientFactory.create(
+ ExternalVersionControlServiceDefinition,
+ channel
+);
+
// e.g. How to use `authServiceClient`?
//
// await authServiceClient.login({
diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.ts
index ff0462e822..3b019b9b38 100644
--- a/frontend/src/store/modules/index.ts
+++ b/frontend/src/store/modules/index.ts
@@ -20,7 +20,6 @@ export * from "./pipeline";
export * from "./slowQueryPolicy";
export * from "./principal";
export * from "./project";
-export * from "./repository";
export * from "./router";
export * from "./stage";
export * from "./sql";
diff --git a/frontend/src/store/modules/repository.ts b/frontend/src/store/modules/repository.ts
deleted file mode 100644
index 13ff675409..0000000000
--- a/frontend/src/store/modules/repository.ts
+++ /dev/null
@@ -1,79 +0,0 @@
-import { defineStore } from "pinia";
-import axios from "axios";
-import {
- Project,
- Repository,
- RepositoryState,
- ResourceIdentifier,
- ResourceObject,
- unknown,
- VCS,
- VCSId,
-} from "@/types";
-import { useLegacyProjectStore } from "./project";
-import { useVCSStore } from "./vcs";
-
-function convert(
- repository: ResourceObject,
- includedList: ResourceObject[]
-): Repository {
- const vcsId = (repository.relationships!.vcs.data as ResourceIdentifier).id;
- let vcs: VCS = unknown("VCS") as VCS;
- vcs.id = parseInt(vcsId);
-
- const projectId = (
- repository.relationships!.project.data as ResourceIdentifier
- ).id;
- let project: Project = unknown("PROJECT") as Project;
- project.id = parseInt(projectId);
-
- const vcsStore = useVCSStore();
- const projectStore = useLegacyProjectStore();
- for (const item of includedList || []) {
- if (item.type == "vcs" && item.id == vcsId) {
- vcs = vcsStore.convert(item, includedList || []);
- }
- if (item.type == "project" && item.id == projectId) {
- project = projectStore.convert(item, includedList);
- }
- }
-
- return {
- ...(repository.attributes as Omit<Repository, "id" | "vcs" | "project">),
- id: repository.id,
- vcs,
- project,
- };
-}
-
-export const useRepositoryStore = defineStore("repository", {
- state: (): RepositoryState => ({
- repositoryListByVCSId: new Map(),
- }),
- actions: {
- getRepositoryListByVCSId(vcsId: VCSId): Repository[] {
- return this.repositoryListByVCSId.get(vcsId) || [];
- },
- setRepositoryListByVCSId({
- vcsId,
- repositoryList,
- }: {
- vcsId: VCSId;
- repositoryList: Repository[];
- }) {
- this.repositoryListByVCSId.set(vcsId, repositoryList);
- },
- async fetchRepositoryListByVCSId(vcsId: VCSId): Promise<Repository[]> {
- const data = (await axios.get(`/api/vcs/${vcsId}/repository`)).data;
-
- const repositoryList: Repository[] = data.data.map(
- (repository: ResourceObject) => {
- return convert(repository, data.included);
- }
- );
-
- this.setRepositoryListByVCSId({ vcsId, repositoryList });
- return repositoryList;
- },
- },
-});
diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.ts
index 372b24d285..ee3def7246 100644
--- a/frontend/src/store/modules/v1/common.ts
+++ b/frontend/src/store/modules/v1/common.ts
@@ -19,6 +19,7 @@ export const settingNamePrefix = "settings/";
export const sheetNamePrefix = "sheets/";
export const databaseGroupNamePrefix = "databaseGroups/";
export const schemaGroupNamePrefix = "schemaGroups/";
+export const externalVersionControlPrefix = "externalVersionControls/";
export const getNameParentTokens = (
name: string,
@@ -143,3 +144,7 @@ export const getSheetPathByLegacyProject = (
project
)}/${sheetNamePrefix}${sheetId}`;
};
+
+export const getProjectPathFromRepoName = (repoName: string): string => {
+ return repoName.split("/gitOpsInfo")[0];
+};
diff --git a/frontend/src/store/modules/v1/repository.ts b/frontend/src/store/modules/v1/repository.ts
index e2fc9e97b4..9884e94bc3 100644
--- a/frontend/src/store/modules/v1/repository.ts
+++ b/frontend/src/store/modules/v1/repository.ts
@@ -1,11 +1,23 @@
import { defineStore } from "pinia";
import { reactive } from "vue";
import { isEqual, isUndefined } from "lodash-es";
-import { projectServiceClient } from "@/grpcweb";
+import {
+ projectServiceClient,
+ externalVersionControlServiceClient,
+} from "@/grpcweb";
import { ProjectGitOpsInfo } from "@/types/proto/v1/externalvs_service";
+import { VCSId, ComposedRepository } from "@/types";
+import {
+ externalVersionControlPrefix,
+ getProjectPathFromRepoName,
+} from "./common";
+import { useProjectV1Store } from "./project";
export const useRepositoryV1Store = defineStore("repository_v1", () => {
const repositoryMapByProject = reactive(new Map<string, ProjectGitOpsInfo>());
+ const repositoryMapByVCSId = reactive(
+ new Map<string, ComposedRepository[]>()
+ );
const fetchRepositoryByProject = async (
project: string
@@ -79,12 +91,43 @@ export const useRepositoryV1Store = defineStore("repository_v1", () => {
return resp.pullRequestUrl;
};
+ const fetchRepositoryListByVCSId = async (
+ vcsId: VCSId
+ ): Promise<ProjectGitOpsInfo[]> => {
+ const resp =
+ await externalVersionControlServiceClient.listProjectGitOpsInfo({
+ name: `${externalVersionControlPrefix}${vcsId}`,
+ });
+
+ const projectV1Store = useProjectV1Store();
+ const repoList: ComposedRepository[] = await Promise.all(
+ resp.projectGitopsInfo.map(async (repo) => {
+ const project = await projectV1Store.getOrFetchProjectByName(
+ getProjectPathFromRepoName(repo.name)
+ );
+ return {
+ ...repo,
+ project,
+ };
+ })
+ );
+
+ repositoryMapByVCSId.set(`${vcsId}`, repoList);
+ return repoList;
+ };
+
+ const getRepositoryListByVCSId = (vcsId: VCSId): ComposedRepository[] => {
+ return repositoryMapByVCSId.get(`${vcsId}`) || [];
+ };
+
return {
setupSQLReviewCI,
upsertRepository,
deleteRepository,
getRepositoryByProject,
getOrFetchRepositoryByProject,
+ fetchRepositoryListByVCSId,
+ getRepositoryListByVCSId,
};
});
diff --git a/frontend/src/types/common.ts b/frontend/src/types/common.ts
index 9284f089f3..13e2bc3e75 100644
--- a/frontend/src/types/common.ts
+++ b/frontend/src/types/common.ts
@@ -13,9 +13,7 @@ import { Issue } from "./issue";
import { Pipeline, Stage, Task, TaskProgress } from "./pipeline";
import { Principal } from "./principal";
import { Project, ProjectMember } from "./project";
-import { Repository } from "./repository";
import { VCS } from "./vcs";
-import { Sheet } from "./sheet";
import { SQLReviewPolicy } from "./sqlReview";
import { AuditLog, AuditActivityType, AuditActivityLevel } from "./auditLog";
import { BackupPlanSchedule } from "@/types/proto/v1/org_policy_service";
@@ -154,9 +152,7 @@ interface ResourceMaker {
(type: "INBOX"): Inbox;
(type: "BOOKMARK"): Bookmark;
(type: "VCS"): VCS;
- (type: "REPOSITORY"): Repository;
(type: "ANOMALY"): Anomaly;
- (type: "SHEET"): Sheet;
(type: "SQL_REVIEW"): SQLReviewPolicy;
(type: "AUDIT_LOG"): AuditLog;
}
@@ -366,23 +362,6 @@ const makeUnknown = (type: ResourceType) => {
secret: "",
};
- const UNKNOWN_REPOSITORY: Repository = {
- id: UNKNOWN_ID,
- vcs: UNKNOWN_VCS,
- project: UNKNOWN_PROJECT,
- name: "",
- fullPath: "",
- webUrl: "",
- baseDirectory: "",
- branchFilter: "",
- filePathTemplate: "",
- schemaPathTemplate: "",
- sheetPathTemplate: "",
- enableSQLReviewCI: false,
- sqlReviewCIPullRequestURL: "",
- externalId: UNKNOWN_ID.toString(),
- };
-
const UNKNOWN_ANOMALY: Anomaly = {
id: UNKNOWN_ID,
creator: UNKNOWN_PRINCIPAL,
@@ -402,29 +381,6 @@ const makeUnknown = (type: ResourceType) => {
},
};
- const UNKNOWN_SHEET: Sheet = {
- id: UNKNOWN_ID,
- rowStatus: "NORMAL",
- creator: UNKNOWN_PRINCIPAL,
- creatorId: UNKNOWN_ID,
- createdTs: 0,
- updater: UNKNOWN_PRINCIPAL,
- updatedTs: 0,
- projectId: UNKNOWN_ID,
- project: UNKNOWN_PROJECT,
- databaseId: UNKNOWN_ID,
- database: UNKNOWN_DATABASE,
- name: "<<Unknown sheet>>",
- statement: "",
- visibility: "PRIVATE",
- source: "BYTEBASE",
- type: "SQL",
- starred: false,
- pinned: false,
- payload: {},
- size: 0,
- };
-
switch (type) {
case "PRINCIPAL":
return UNKNOWN_PRINCIPAL;
@@ -460,14 +416,11 @@ const makeUnknown = (type: ResourceType) => {
return UNKNOWN_BOOKMARK;
case "VCS":
return UNKNOWN_VCS;
- case "REPOSITORY":
- return UNKNOWN_REPOSITORY;
case "ANOMALY":
return UNKNOWN_ANOMALY;
- case "SHEET":
- return UNKNOWN_SHEET;
}
};
+
export const unknown = makeUnknown as ResourceMaker;
const makeEmpty = (type: ResourceType) => {
@@ -675,23 +628,6 @@ const makeEmpty = (type: ResourceType) => {
secret: "",
};
- const EMPTY_REPOSITORY: Repository = {
- id: EMPTY_ID,
- vcs: EMPTY_VCS,
- project: EMPTY_PROJECT,
- name: "",
- fullPath: "",
- webUrl: "",
- baseDirectory: "",
- branchFilter: "",
- filePathTemplate: "",
- schemaPathTemplate: "",
- sheetPathTemplate: "",
- enableSQLReviewCI: false,
- sqlReviewCIPullRequestURL: "",
- externalId: EMPTY_ID.toString(),
- };
-
const EMPTY_ANOMALY: Anomaly = {
id: EMPTY_ID,
creator: EMPTY_PRINCIPAL,
@@ -711,29 +647,6 @@ const makeEmpty = (type: ResourceType) => {
},
};
- const EMPTY_SHEET: Sheet = {
- id: EMPTY_ID,
- rowStatus: "NORMAL",
- creator: EMPTY_PRINCIPAL,
- creatorId: EMPTY_ID,
- createdTs: 0,
- updater: EMPTY_PRINCIPAL,
- updatedTs: 0,
- projectId: EMPTY_ID,
- project: EMPTY_PROJECT,
- databaseId: EMPTY_ID,
- database: EMPTY_DATABASE,
- name: "<<Empty sheet>>",
- statement: "",
- visibility: "PRIVATE",
- source: "BYTEBASE",
- type: "SQL",
- starred: false,
- pinned: false,
- payload: {},
- size: 0,
- };
-
const EMPTY_AUDIT_LOG: AuditLog = {
createdTs: 0,
creator: EMPTY_PRINCIPAL.email,
@@ -778,14 +691,11 @@ const makeEmpty = (type: ResourceType) => {
return EMPTY_BOOKMARK;
case "VCS":
return EMPTY_VCS;
- case "REPOSITORY":
- return EMPTY_REPOSITORY;
case "ANOMALY":
return EMPTY_ANOMALY;
- case "SHEET":
- return EMPTY_SHEET;
case "AUDIT_LOG":
return EMPTY_AUDIT_LOG;
}
};
+
export const empty = makeEmpty as ResourceMaker;
diff --git a/frontend/src/types/repository.ts b/frontend/src/types/repository.ts
index a5b265e099..fda06b55e8 100644
--- a/frontend/src/types/repository.ts
+++ b/frontend/src/types/repository.ts
@@ -1,33 +1,3 @@
-import isEmpty from "lodash-es/isEmpty";
-import { RepositoryId } from "./id";
-import { Project } from "./project";
-import { VCS } from "./vcs";
-
-export type Repository = {
- id: RepositoryId;
-
- // Related fields
- vcs: VCS;
- project: Project;
-
- // Domain specific fields
- // e.g. sample-project
- name: string;
- // e.g. bytebase/sample-project
- fullPath: string;
- // e.g. http://gitlab.bytebase.com/bytebase/sample-project
- webUrl: string;
- baseDirectory: string;
- branchFilter: string;
- filePathTemplate: string;
- schemaPathTemplate: string;
- sheetPathTemplate: string;
- enableSQLReviewCI: boolean;
- sqlReviewCIPullRequestURL: string;
- // e.g. In GitLab, this is the corresponding project id.
- externalId: string;
-};
-
export type RepositoryConfig = {
baseDirectory: string;
branchFilter: string;
@@ -47,93 +17,3 @@ export type ExternalRepositoryInfo = {
// e.g. http://gitlab.bytebase.com/bytebase/sample-project
webUrl: string;
};
-
-type WebUrlReplaceParams = {
- DB_NAME?: string;
- VERSION?: string;
- TYPE?: "ddl" | "dml";
- ENV_ID?: string;
-};
-
-export function baseDirectoryWebUrl(
- repository: Repository,
- params: WebUrlReplaceParams = {}
-): string {
- // If branchFilter has wildcard, we can't locate to the exact branch name, thus we will just return the repository web url
- if (repository.branchFilter.includes("*")) {
- return repository.webUrl;
- }
- let url = "";
- if (repository.vcs.type == "GITLAB") {
- url = `${repository.webUrl}/-/tree/${repository.branchFilter}`;
- if (!isEmpty(repository.baseDirectory)) {
- url += `/${repository.baseDirectory}`;
- }
- } else if (repository.vcs.type == "GITHUB") {
- url = `${repository.webUrl}/tree/${repository.branchFilter}`;
- if (!isEmpty(repository.baseDirectory)) {
- url += `/${repository.baseDirectory}`;
- }
- } else if (repository.vcs.type == "BITBUCKET") {
- url = `${repository.webUrl}/src/${repository.branchFilter}`;
- if (!isEmpty(repository.baseDirectory)) {
- url += `/${repository.baseDirectory}`;
- }
- }
- if (url) {
- // Replace the patterns in the filePathTemplate if possible.
- const segments = repository.filePathTemplate.split("/");
- segments.pop(); // exclude the last one, it's the filename.
- // Try to replace the segments from left to right.
- // Once we meet a "dynamic" segment which has a pattern that cannot be replaced
- // we won't push it, either the segments behind it.
- // E.g., the filePathTemplate is
- // configure/{{ENV_ID}}/20220707-wechat/{{TYPE}}/**/**/**/{{DB_NAME}}##{{VERSION}}##{{DESCRIPTION}}.sql
- /**
- The segments are
- - configure
- - {{ENV_ID}}
- - 20220707-wechat
- - {{TYPE}}
- - **
- - **
- - **
- When
- - ENV_ID=dev
- - TYPE=migrate
- we are confident enough that the path will be started with
- "/configure/dev/20220707-wechat/migrate"
- That's our best effort.
- */
- for (let i = 0; i < segments.length; i++) {
- const segment = segments[i];
- const replaced = replaceParams(segment, params);
- if (replaced.match(/[*{}]/)) {
- // Still remained some patterns cannot be replaced in the value.
- break;
- }
- url += `/${replaced}`;
- }
-
- return url;
- }
-
- // Fallback for other types of VCS.
- // Shouldn't reach this line.
- return repository.webUrl;
-}
-
-const replaceParams = (
- template: string,
- params: WebUrlReplaceParams = {}
-): string => {
- let replaced = template;
- Object.keys(params).forEach((key) => {
- const pattern = `{{${key}}}`;
- const value = params[key as keyof WebUrlReplaceParams];
- if (value) {
- replaced = replaced.replaceAll(pattern, value);
- }
- });
- return replaced;
-};
diff --git a/frontend/src/types/v1/index.ts b/frontend/src/types/v1/index.ts
index 9c137b63dd..d6d18abebf 100644
--- a/frontend/src/types/v1/index.ts
+++ b/frontend/src/types/v1/index.ts
@@ -6,3 +6,4 @@ export * from "./project";
export * from "./projectWebhook";
export * from "./role";
export * from "./user";
+export * from "./repository";
diff --git a/frontend/src/types/v1/repository.ts b/frontend/src/types/v1/repository.ts
new file mode 100644
index 0000000000..e65fd42100
--- /dev/null
+++ b/frontend/src/types/v1/repository.ts
@@ -0,0 +1,6 @@
+import { Project } from "@/types/proto/v1/project_service";
+import { ProjectGitOpsInfo } from "@/types/proto/v1/externalvs_service";
+
+export interface ComposedRepository extends ProjectGitOpsInfo {
+ project: Project;
+}
diff --git a/frontend/src/utils/environment.ts b/frontend/src/utils/environment.ts
index 67bbfd5ee5..02fda6e90e 100644
--- a/frontend/src/utils/environment.ts
+++ b/frontend/src/utils/environment.ts
@@ -1,6 +1,4 @@
import { Environment } from "../types";
-import { Environment as EnvironmentV1 } from "@/types/proto/v1/environment_service";
-import { State } from "@/types/proto/v1/common";
export function environmentName(environment: Environment) {
let name = environment.name;
@@ -9,11 +7,3 @@ export function environmentName(environment: Environment) {
}
return name;
}
-
-export function environmentTitleV1(environment: EnvironmentV1) {
- let name = environment.title;
- if (environment.state == State.DELETED) {
- name += " (Archived)";
- }
- return name;
-}
diff --git a/frontend/src/views/SettingWorkspaceVCSDetail.vue b/frontend/src/views/SettingWorkspaceVCSDetail.vue
index 6f31c5c310..92d9c9e894 100644
--- a/frontend/src/views/SettingWorkspaceVCSDetail.vue
+++ b/frontend/src/views/SettingWorkspaceVCSDetail.vue
@@ -197,7 +197,7 @@ import {
import {
pushNotification,
useOAuthStore,
- useRepositoryStore,
+ useRepositoryV1Store,
useVCSStore,
} from "@/store";
@@ -219,7 +219,7 @@ export default defineComponent({
},
setup(props) {
const vcsStore = useVCSStore();
- const repositoryStore = useRepositoryStore();
+ const repositoryV1Store = useRepositoryV1Store();
const router = useRouter();
const vcs = computed((): VCS => {
@@ -268,7 +268,7 @@ export default defineComponent({
};
const prepareRepositoryList = () => {
- repositoryStore.fetchRepositoryListByVCSId(vcs.value.id);
+ repositoryV1Store.fetchRepositoryListByVCSId(vcs.value.id);
};
watchEffect(prepareRepositoryList);
@@ -283,7 +283,7 @@ export default defineComponent({
});
const repositoryList = computed(() =>
- repositoryStore.getRepositoryListByVCSId(vcs.value.id)
+ repositoryV1Store.getRepositoryListByVCSId(vcs.value.id)
);
const allowUpdate = computed(() => {
diff --git a/proto/v1/externalvs_service.proto b/proto/v1/externalvs_service.proto
index cc03aa4cb8..95e372a7b7 100644
--- a/proto/v1/externalvs_service.proto
+++ b/proto/v1/externalvs_service.proto
@@ -215,6 +215,8 @@ message ProjectGitOpsInfo {
string webhook_endpoint_id = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
string access_token = 14 [(google.api.field_behavior) = INPUT_ONLY];
+
google.protobuf.Timestamp expires_time = 15 [(google.api.field_behavior) = INPUT_ONLY];
+
string refresh_token = 16 [(google.api.field_behavior) = INPUT_ONLY];
}