Skip to content

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

chore: migrate fetch issue to v1 (#6204)

ecmadao2204132efac5
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.go
index 907610c3d7..035a6eb0b3 100644
--- a/backend/api/v1/sheet_service.go
+++ b/backend/api/v1/sheet_service.go
@@ -319,6 +319,8 @@ func (s *SheetService) UpdateSheet(ctx context.Context, request *v1pb.UpdateShee
}
stringVisibility := string(visibility)
sheetPatch.Visibility = &stringVisibility
+ case "payload":
+ sheetPatch.Name = &request.Sheet.Payload
default:
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid update mask path %q", path))
}
@@ -661,6 +663,7 @@ func (s *SheetService) convertToAPISheetMessage(ctx context.Context, sheet *stor
Source: source,
Type: tp,
Starred: sheet.Starred,
+ Payload: sheet.Payload,
}, nil
}
@@ -705,6 +708,7 @@ func convertToStoreSheetMessage(projectUID int, databaseUID *int, creatorID int,
Visibility: visibility,
Source: source,
Type: tp,
+ Payload: sheet.Payload,
}, nil
}
diff --git a/frontend/src/components/Project/ProjectSetting/ProjectMemberTable/ProjectMemberRolePanel.vue b/frontend/src/components/Project/ProjectSetting/ProjectMemberTable/ProjectMemberRolePanel.vue
index a0a8d2ff8f..94afb12e94 100644
--- a/frontend/src/components/Project/ProjectSetting/ProjectMemberTable/ProjectMemberRolePanel.vue
+++ b/frontend/src/components/Project/ProjectSetting/ProjectMemberTable/ProjectMemberRolePanel.vue
@@ -102,7 +102,6 @@ import { useI18n } from "vue-i18n";
import RoleDescription from "./RoleDescription.vue";
import { cloneDeep, isEqual, uniq } from "lodash-es";
import { State } from "@/types/proto/v1/common";
-import { getUserEmailFromIdentifier } from "@/store/modules/v1/common";
import { ComposedProjectMember } from "./types";
export interface FormattedCondition {
@@ -204,8 +203,7 @@ const allowRemoveRole = (role: string) => {
);
const members = (binding?.members || [])
.map((userIdentifier) => {
- const email = getUserEmailFromIdentifier(userIdentifier);
- return userStore.getUserByEmail(email);
+ return userStore.getUserByIdentifier(userIdentifier);
})
.filter((user) => user?.state === State.ACTIVE);
if (!binding || members.length === 1) {
diff --git a/frontend/src/grpcweb/index.ts b/frontend/src/grpcweb/index.ts
index 38f4295ea8..04ad429e75 100644
--- a/frontend/src/grpcweb/index.ts
+++ b/frontend/src/grpcweb/index.ts
@@ -15,6 +15,7 @@ import { RiskServiceDefinition } from "@/types/proto/v1/risk_service";
import { SettingServiceDefinition } from "@/types/proto/v1/setting_service";
import { ReviewServiceDefinition } from "@/types/proto/v1/review_service";
import { DatabaseServiceDefinition } from "@/types/proto/v1/database_service";
+import { SheetServiceDefinition } from "@/types/proto/v1/sheet_service";
// Create each grpc service client.
// Reference: https://github.com/deeplay-io/nice-grpc/blob/master/packages/nice-grpc-web/README.md
@@ -81,6 +82,10 @@ export const settingServiceClient = clientFactory.create(
SettingServiceDefinition,
channel
);
+export const sheetServiceClient = clientFactory.create(
+ SheetServiceDefinition,
+ channel
+);
export const reviewServiceClient = clientFactory.create(
ReviewServiceDefinition,
diff --git a/frontend/src/store/modules/sheet.ts b/frontend/src/store/modules/sheet.ts
index 5803c1793d..9f3d056e73 100644
--- a/frontend/src/store/modules/sheet.ts
+++ b/frontend/src/store/modules/sheet.ts
@@ -214,54 +214,6 @@ export const useSheetStore = defineStore("sheet", {
return sheet;
},
- async fetchMySheetList() {
- const resData = (await axios.get(`/api/sheet/my`)).data;
- const sheetList: Sheet[] = resData.data.map((rawData: ResourceObject) => {
- const sheet = convertSheet(rawData, resData.included);
- this.setSheetById({
- sheetId: sheet.id,
- sheet: sheet,
- });
- return sheet;
- });
-
- sheetList.sort((a, b) => b.createdTs - a.createdTs);
- this.setSheetList(sheetList);
-
- return sheetList;
- },
- async fetchSharedSheetList() {
- const resData = (await axios.get(`/api/sheet/shared`)).data;
- const sheetList: Sheet[] = resData.data.map((rawData: ResourceObject) => {
- const sheet = convertSheet(rawData, resData.included);
- this.setSheetById({
- sheetId: sheet.id,
- sheet: sheet,
- });
- return sheet;
- });
-
- sheetList.sort((a, b) => b.createdTs - a.createdTs);
- this.setSheetList(sheetList);
-
- return sheetList;
- },
- async fetchStarredSheetList() {
- const resData = (await axios.get(`/api/sheet/starred`)).data;
- const sheetList: Sheet[] = resData.data.map((rawData: ResourceObject) => {
- const sheet = convertSheet(rawData, resData.included);
- this.setSheetById({
- sheetId: sheet.id,
- sheet: sheet,
- });
- return sheet;
- });
-
- sheetList.sort((a, b) => b.createdTs - a.createdTs);
- this.setSheetList(sheetList);
-
- return sheetList;
- },
async fetchSheetById(sheetId: SheetId) {
try {
const data = (await axios.get(`/api/sheet/${sheetId}`)).data;
diff --git a/frontend/src/store/modules/user.ts b/frontend/src/store/modules/user.ts
index 9809652e6f..4e44844168 100644
--- a/frontend/src/store/modules/user.ts
+++ b/frontend/src/store/modules/user.ts
@@ -7,7 +7,11 @@ import {
UserType,
} from "@/types/proto/v1/auth_service";
import { isEqual, isUndefined } from "lodash-es";
-import { getUserId, userNamePrefix } from "./v1/common";
+import {
+ getUserId,
+ userNamePrefix,
+ getUserEmailFromIdentifier,
+} from "./v1/common";
import { Principal, PrincipalType, RoleType } from "@/types";
import { State } from "@/types/proto/v1/common";
import { extractUserUID } from "@/utils";
@@ -91,6 +95,9 @@ export const useUserStore = defineStore("user", {
getUserById(uid: string) {
return this.userMapByName.get(getUserNameWithUserId(uid));
},
+ getUserByIdentifier(identifier: string) {
+ return this.getUserByEmail(getUserEmailFromIdentifier(identifier));
+ },
getUserByEmail(email: string) {
return [...this.userMapByName.values()].find(
(user) => user.email === email
diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.ts
index 809ae18e9a..91d6156f88 100644
--- a/frontend/src/store/modules/v1/common.ts
+++ b/frontend/src/store/modules/v1/common.ts
@@ -14,6 +14,7 @@ export const databaseNamePrefix = "databases/";
export const idpNamePrefix = "idps/";
export const policyNamePrefix = "policies/";
export const settingNamePrefix = "settings/";
+export const sheetNamePrefix = "sheets/";
export const getNameParentTokens = (
name: string,
@@ -43,8 +44,25 @@ export const getUserId = (name: string): number => {
return userId;
};
+export const getProjectAndSheetId = (name: string): string[] => {
+ const tokens = getNameParentTokens(name, [
+ projectNamePrefix,
+ sheetNamePrefix,
+ ]);
+
+ return tokens;
+};
+
+export const getDatabaseId = (name: string): string => {
+ const sections = name.split(databaseNamePrefix);
+ if (sections.length != 2) {
+ return "";
+ }
+ return sections[1];
+};
+
export const getUserEmailFromIdentifier = (identifier: string): string => {
- return identifier.replace(/^user:/, "");
+ return identifier.replace(/^(user:|users\/)/, "");
};
export const getIdentityProviderResourceId = (name: string): ResourceId => {
diff --git a/frontend/src/store/modules/v1/project.ts b/frontend/src/store/modules/v1/project.ts
index 7c8fdb2643..721971a250 100644
--- a/frontend/src/store/modules/v1/project.ts
+++ b/frontend/src/store/modules/v1/project.ts
@@ -17,6 +17,7 @@ import { State } from "@/types/proto/v1/common";
import { User } from "@/types/proto/v1/auth_service";
import { useCurrentUserV1 } from "../auth";
import { hasWorkspacePermissionV1 } from "@/utils";
+import { projectNamePrefix } from "./common";
export const useProjectV1Store = defineStore("project_v1", () => {
const projectMapByName = reactive(new Map<ResourceId, ComposedProject>());
@@ -75,6 +76,14 @@ export const useProjectV1Store = defineStore("project_v1", () => {
unknownProject()
);
};
+ const getProjectByName = (name: string) => {
+ if (name === String(EMPTY_ID)) {
+ return emptyProject();
+ }
+ return (
+ projectMapByName.get(`${projectNamePrefix}${name}`) ?? unknownProject()
+ );
+ };
const fetchProjectByName = async (name: string) => {
const project = await projectServiceClient.getProject({
name,
@@ -83,7 +92,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {
return project as ComposedProject;
};
const fetchProjectByUID = async (uid: string) => {
- return fetchProjectByName(`projects/${uid}`);
+ return fetchProjectByName(`${projectNamePrefix}${uid}`);
};
const getOrFetchProjectByName = async (name: string) => {
const cachedData = projectMapByName.get(name);
@@ -141,6 +150,7 @@ export const useProjectV1Store = defineStore("project_v1", () => {
getProjectListByUser,
upsertProjectMap,
getProjectByUID,
+ getProjectByName,
fetchProjectList,
fetchProjectByName,
fetchProjectByUID,
diff --git a/frontend/src/store/modules/v1/sheet.ts b/frontend/src/store/modules/v1/sheet.ts
new file mode 100644
index 0000000000..87eba1ca3e
--- /dev/null
+++ b/frontend/src/store/modules/v1/sheet.ts
@@ -0,0 +1,212 @@
+import { defineStore } from "pinia";
+import { sheetServiceClient } from "@/grpcweb";
+import { isEqual, isUndefined, isEmpty } from "lodash-es";
+import { Sheet } from "@/types/proto/v1/sheet_service";
+import { useTabStore } from "../tab";
+import { SheetId, UNKNOWN_ID } from "@/types";
+import { useCurrentUserV1 } from "../auth";
+import {
+ getUserEmailFromIdentifier,
+ sheetNamePrefix,
+ projectNamePrefix,
+ getProjectAndSheetId,
+} from "./common";
+import { isSheetReadableV1 } from "@/utils";
+
+interface SheetState {
+ sheetByName: Map<string, Sheet>;
+}
+
+export const useSheetV1Store = defineStore("sheet_v1", {
+ state: (): SheetState => ({
+ sheetByName: new Map<string, Sheet>(),
+ }),
+
+ getters: {
+ currentSheet(state) {
+ const currentTab = useTabStore().currentTab;
+
+ if (!currentTab || isEmpty(currentTab)) {
+ return;
+ }
+
+ // TODO: use resource id instead
+ const sheetId = currentTab.sheetId || UNKNOWN_ID;
+ for (const [_, sheet] of state.sheetByName) {
+ const [_, uid] = getProjectAndSheetId(sheet.name);
+ if (uid == sheetId) {
+ return sheet;
+ }
+ }
+ },
+ isCreator() {
+ const currentUserV1 = useCurrentUserV1();
+ const currentSheet = this.currentSheet as Sheet;
+
+ if (!currentSheet) return false;
+
+ return (
+ getUserEmailFromIdentifier(currentSheet.creator) ===
+ currentUserV1.value.email
+ );
+ },
+ /**
+ * Check the sheet whether is read-only.
+ * 1. If the sheet is not created yet, it cannot be edited.
+ * 2. If the sheet is created by the current user, it can be edited.
+ * 3. If the sheet is created by other user, will be checked the visibility of the sheet.
+ * a) If the sheet's visibility is private or public, it can be edited only if the current user is the creator of the sheet.
+ * b) If the sheet's visibility is project, will be checked whether the current user is the `OWNER` of the project, only the current user is the `OWNER` of the project, it can be edited.
+ */
+ isReadOnly() {
+ const currentSheet = this.currentSheet as Sheet;
+
+ // We don't have a selected sheet, we've got nothing to edit.
+ if (!currentSheet) {
+ return false;
+ }
+
+ // Incomplete sheets should be read-only. e.g. 100MB sheet from issue task.
+ if (currentSheet.content.length !== currentSheet.contentSize) {
+ return true;
+ }
+
+ return !isSheetReadableV1(currentSheet);
+ },
+ },
+
+ actions: {
+ setSheetList(sheets: Sheet[]) {
+ for (const sheet of sheets) {
+ this.sheetByName.set(sheet.name, sheet);
+ }
+ },
+ async createSheet(parentPath: string, sheet: Partial<Sheet>) {
+ const createdSheet = await sheetServiceClient.createSheet({
+ parent: parentPath,
+ sheet,
+ });
+ this.sheetByName.set(createdSheet.name, createdSheet);
+ return createdSheet;
+ },
+ async upsertSheet(parentPath: string, sheet: Partial<Sheet>) {
+ if (sheet.name) {
+ const exist = this.sheetByName.get(sheet.name);
+ if (!exist) {
+ return;
+ }
+ return this.patchSheetById(getUpdateMaskForSheet(exist, sheet), sheet);
+ }
+
+ return this.createSheet(parentPath, sheet);
+ },
+ async patchSheetById(updateMask: string[], sheet: Partial<Sheet>) {
+ const updatedSheet = await sheetServiceClient.updateSheet({
+ sheet,
+ updateMask,
+ });
+ this.sheetByName.set(updatedSheet.name, updatedSheet);
+ return updatedSheet;
+ },
+ async fetchSheetById({
+ parentPath,
+ sheetId,
+ }: {
+ parentPath: string;
+ sheetId: SheetId;
+ }) {
+ const sheet = await sheetServiceClient.getSheet({
+ name: `${parentPath}/${sheetNamePrefix}${sheetId}`,
+ });
+ this.sheetByName.set(sheet.name, sheet);
+ return sheet;
+ },
+ async getOrFetchSheetById({
+ parentPath,
+ sheetId,
+ }: {
+ parentPath: string;
+ sheetId: SheetId;
+ }) {
+ const name = `${parentPath}/${sheetNamePrefix}${sheetId}`;
+ const storedSheet = this.sheetByName.get(name);
+ if (storedSheet) {
+ return storedSheet;
+ }
+ return this.fetchSheetById({
+ parentPath,
+ sheetId,
+ });
+ },
+ async fetchSharedSheetList() {
+ const currentUserV1 = useCurrentUserV1();
+ const { sheets } = await sheetServiceClient.searchSheets({
+ parent: `${projectNamePrefix}-`,
+ filter: `creator != users/${currentUserV1.value.email}`,
+ });
+ this.setSheetList(sheets);
+ return sheets;
+ },
+ async fetchStarredSheetList() {
+ const { sheets } = await sheetServiceClient.searchSheets({
+ parent: `${projectNamePrefix}-`,
+ filter: "starred = true",
+ });
+ this.setSheetList(sheets);
+ return sheets;
+ },
+ async fetchMySheetList() {
+ const currentUserV1 = useCurrentUserV1();
+ const { sheets } = await sheetServiceClient.searchSheets({
+ parent: `${projectNamePrefix}-`,
+ filter: `creator = users/${currentUserV1.value.email}`,
+ });
+ this.setSheetList(sheets);
+ return sheets;
+ },
+ async deleteSheetByName(name: string) {
+ await sheetServiceClient.deleteSheet({ name });
+ this.sheetByName.delete(name);
+ },
+ async syncSheetFromVCS(project: string) {
+ await sheetServiceClient.syncSheets({
+ parent: project,
+ });
+ },
+ },
+});
+
+const getUpdateMaskForSheet = (
+ origin: Sheet,
+ update: Partial<Sheet>
+): string[] => {
+ const updateMask: string[] = [];
+ if (!isUndefined(update.title) && !isEqual(origin.title, update.title)) {
+ updateMask.push("title");
+ }
+ if (
+ !isUndefined(update.content) &&
+ !isEqual(origin.content, update.content)
+ ) {
+ updateMask.push("content");
+ }
+ if (
+ !isUndefined(update.visibility) &&
+ !isEqual(origin.visibility, update.visibility)
+ ) {
+ updateMask.push("visibility");
+ }
+ if (
+ !isUndefined(update.starred) &&
+ !isEqual(origin.starred, update.starred)
+ ) {
+ updateMask.push("starred");
+ }
+ if (
+ !isUndefined(update.payload) &&
+ !isEqual(origin.payload, update.payload)
+ ) {
+ updateMask.push("payload");
+ }
+ return updateMask;
+};
diff --git a/frontend/src/types/proto/v1/review_service.ts b/frontend/src/types/proto/v1/review_service.ts
index b36c935538..cd42c07880 100644
--- a/frontend/src/types/proto/v1/review_service.ts
+++ b/frontend/src/types/proto/v1/review_service.ts
@@ -217,7 +217,10 @@ export interface ApprovalTemplate {
flow?: ApprovalFlow;
title: string;
description: string;
- /** The name of the creator in users/{email} format. */
+ /**
+ * The name of the creator in users/{email} format.
+ * TODO: we should mark it as OUTPUT_ONLY, but currently the frontend will post the approval setting with creator.
+ */
creator: string;
}
diff --git a/frontend/src/types/proto/v1/sheet_service.ts b/frontend/src/types/proto/v1/sheet_service.ts
index a3d3ea0216..61e2d375d5 100644
--- a/frontend/src/types/proto/v1/sheet_service.ts
+++ b/frontend/src/types/proto/v1/sheet_service.ts
@@ -146,6 +146,8 @@ export interface Sheet {
type: Sheet_Type;
/** starred indicates whether the sheet is starred by the current authenticated user. */
starred: boolean;
+ /** TODO: deprecate this field. */
+ payload: string;
}
export enum Sheet_Visibility {
@@ -802,6 +804,7 @@ function createBaseSheet(): Sheet {
source: 0,
type: 0,
starred: false,
+ payload: "",
};
}
@@ -843,6 +846,9 @@ export const Sheet = {
if (message.starred === true) {
writer.uint32(96).bool(message.starred);
}
+ if (message.payload !== "") {
+ writer.uint32(106).string(message.payload);
+ }
return writer;
},
@@ -937,6 +943,13 @@ export const Sheet = {
message.starred = reader.bool();
continue;
+ case 13:
+ if (tag !== 106) {
+ break;
+ }
+
+ message.payload = reader.string();
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -960,6 +973,7 @@ export const Sheet = {
source: isSet(object.source) ? sheet_SourceFromJSON(object.source) : 0,
type: isSet(object.type) ? sheet_TypeFromJSON(object.type) : 0,
starred: isSet(object.starred) ? Boolean(object.starred) : false,
+ payload: isSet(object.payload) ? String(object.payload) : "",
};
},
@@ -978,6 +992,7 @@ export const Sheet = {
message.source !== undefined && (obj.source = sheet_SourceToJSON(message.source));
message.type !== undefined && (obj.type = sheet_TypeToJSON(message.type));
message.starred !== undefined && (obj.starred = message.starred);
+ message.payload !== undefined && (obj.payload = message.payload);
return obj;
},
@@ -999,6 +1014,7 @@ export const Sheet = {
message.source = object.source ?? 0;
message.type = object.type ?? 0;
message.starred = object.starred ?? false;
+ message.payload = object.payload ?? "";
return message;
},
};
diff --git a/frontend/src/utils/index.ts b/frontend/src/utils/index.ts
index 367d268b1b..49bd179cf3 100644
--- a/frontend/src/utils/index.ts
+++ b/frontend/src/utils/index.ts
@@ -18,6 +18,7 @@ export * from "./tab";
export * from "./task";
export * from "./policy";
export * from "./sheet";
+export * from "./sheetV1";
export * from "./pev2";
export * from "./web-storage";
export * from "./dom";
diff --git a/frontend/src/utils/sheetV1.ts b/frontend/src/utils/sheetV1.ts
new file mode 100644
index 0000000000..38522269c5
--- /dev/null
+++ b/frontend/src/utils/sheetV1.ts
@@ -0,0 +1,110 @@
+import { isUndefined } from "lodash-es";
+
+import { useCurrentUserV1, useProjectV1Store } from "@/store";
+import { SheetIssueBacktracePayload } from "@/types";
+import {
+ hasPermissionInProjectV1,
+ hasWorkspacePermissionV1,
+ isMemberOfProjectV1,
+} from "../utils";
+import { Sheet, Sheet_Visibility } from "@/types/proto/v1/sheet_service";
+import {
+ getUserEmailFromIdentifier,
+ getProjectAndSheetId,
+} from "@/store/modules/v1/common";
+
+export const isSheetReadableV1 = (sheet: Sheet) => {
+ const currentUserV1 = useCurrentUserV1();
+
+ // readable to
+ // PRIVATE: the creator only
+ // PROJECT: the creator and members in the project, workspace Owner and DBA
+ // PUBLIC: everyone
+
+ if (getUserEmailFromIdentifier(sheet.creator) === currentUserV1.value.email) {
+ // Always readable to the creator
+ return true;
+ }
+ const { visibility } = sheet;
+ if (visibility === Sheet_Visibility.VISIBILITY_PRIVATE) {
+ return false;
+ }
+ if (visibility === Sheet_Visibility.VISIBILITY_PROJECT) {
+ if (
+ hasWorkspacePermissionV1(
+ "bb.permission.workspace.manage-project",
+ currentUserV1.value.userRole
+ )
+ ) {
+ return true;
+ }
+
+ const [projectId, _] = getProjectAndSheetId(sheet.name);
+
+ const projectV1 = useProjectV1Store().getProjectByName(projectId);
+ return isMemberOfProjectV1(projectV1.iamPolicy, currentUserV1.value);
+ }
+ // visibility === "PUBLIC"
+ return true;
+};
+
+export const isSheetWritableV1 = (sheet: Sheet) => {
+ // If the sheet is linked to an issue, it's NOT writable
+ if (getSheetIssueBacktracePayloadV1(sheet)) {
+ return false;
+ }
+
+ const currentUserV1 = useCurrentUserV1();
+
+ // writable to
+ // PRIVATE: the creator only
+ // PROJECT: the creator or project role can manage sheet, workspace Owner and DBA
+ // PUBLIC: the creator only
+
+ if (getUserEmailFromIdentifier(sheet.creator) === currentUserV1.value.email) {
+ // Always writable to the creator
+ return true;
+ }
+ const { visibility } = sheet;
+ if (visibility === Sheet_Visibility.VISIBILITY_PRIVATE) {
+ return false;
+ }
+ if (visibility === Sheet_Visibility.VISIBILITY_PROJECT) {
+ if (
+ hasWorkspacePermissionV1(
+ "bb.permission.workspace.manage-project",
+ currentUserV1.value.userRole
+ )
+ ) {
+ return true;
+ }
+
+ const [projectId, _] = getProjectAndSheetId(sheet.name);
+ const projectV1 = useProjectV1Store().getProjectByName(projectId);
+ const isCurrentUserProjectOwner = () => {
+ return hasPermissionInProjectV1(
+ projectV1.iamPolicy,
+ currentUserV1.value,
+ "bb.permission.project.manage-sheet"
+ );
+ };
+ return isCurrentUserProjectOwner();
+ }
+ // visibility === "PUBLIC"
+ return false;
+};
+
+export const getSheetIssueBacktracePayloadV1 = (sheet: Sheet) => {
+ const maybePayload = JSON.parse(
+ sheet.payload ?? "{}"
+ ) as SheetIssueBacktracePayload;
+ if (
+ maybePayload.type === "bb.sheet.issue-backtrace" &&
+ !isUndefined(maybePayload.issueId) &&
+ !isUndefined(maybePayload.issueName)
+ ) {
+ return maybePayload;
+ }
+
+ return undefined;
+};
diff --git a/frontend/src/utils/slug.ts b/frontend/src/utils/slug.ts
index 70a8759398..ab5a62d6f3 100644
--- a/frontend/src/utils/slug.ts
+++ b/frontend/src/utils/slug.ts
@@ -13,6 +13,8 @@ import {
UNKNOWN_ID,
} from "../types";
import { IdType } from "../types/id";
+import { Sheet as SheetV1 } from "@/types/proto/v1/sheet_service";
+import { getProjectAndSheetId } from "@/store/modules/v1/common";
export function idFromSlug(slug: string): IdType {
const parts = slug.split("-");
@@ -99,3 +101,8 @@ export function connectionSlug(
export function sheetSlug(sheet: Sheet): string {
return [slug(sheet.name), sheet.id].join("-");
}
+
+export function sheetSlugV1(sheet: SheetV1): string {
+ const [_, uid] = getProjectAndSheetId(sheet.name);
+ return [slug(sheet.title), uid].join("-");
+}
diff --git a/frontend/src/utils/workspaceApprovalSetting.ts b/frontend/src/utils/workspaceApprovalSetting.ts
index 0fb076093c..1249f49cb2 100644
--- a/frontend/src/utils/workspaceApprovalSetting.ts
+++ b/frontend/src/utils/workspaceApprovalSetting.ts
@@ -320,8 +320,5 @@ export const creatorOfRule = (rule: LocalApprovalRule) => {
const creatorName = rule.template.creator ?? UNKNOWN_USER_NAME;
if (creatorName === UNKNOWN_USER_NAME) return unknownUser();
- return (
- useUserStore().getUserByEmail(creatorName.replace(/^users\//, "")) ??
- unknownUser()
- );
+ return useUserStore().getUserByIdentifier(creatorName) ?? unknownUser();
};
diff --git a/frontend/src/views/SheetDashboard.vue b/frontend/src/views/SheetDashboard.vue
index cc5dbcc790..ee89c541a6 100644
--- a/frontend/src/views/SheetDashboard.vue
+++ b/frontend/src/views/SheetDashboard.vue
@@ -92,13 +92,14 @@ import { last } from "lodash-es";
import { useDialog } from "naive-ui";
import { t } from "@/plugins/i18n";
+import { Sheet as SheetV1 } from "@/types/proto/v1/sheet_service";
import {
hasFeature,
+ useUserStore,
useProjectV1ListByCurrentUser,
- useSheetStore,
} from "@/store";
-import { Sheet } from "@/types";
-import { getSheetIssueBacktracePayload } from "@/utils";
+import { useSheetV1Store } from "@/store/modules/v1/sheet";
+import { getSheetIssueBacktracePayloadV1 } from "@/utils";
import {
type SheetViewMode,
SheetTable,
@@ -108,7 +109,7 @@ import { Workflow } from "@/types/proto/v1/project_service";
interface LocalState {
isLoading: boolean;
- sheetList: Sheet[];
+ sheetList: SheetV1[];
showFeatureModal: boolean;
}
@@ -119,7 +120,7 @@ const state = reactive<LocalState>({
sheetList: [],
showFeatureModal: false,
});
-const sheetStore = useSheetStore();
+const sheetV1Store = useSheetV1Store();
const projectSelectorValue = ref("");
const sheetSearchValue = ref("");
@@ -145,9 +146,9 @@ const navigationList = computed(() => {
const shownSheetList = computed(() => {
let list = [...state.sheetList];
- const projectId = projectSelectorValue.value;
- if (projectId !== "") {
- list = list.filter((sheet) => String(sheet.project.id) === projectId);
+ const projectName = projectSelectorValue.value;
+ if (projectName !== "") {
+ list = list.filter((sheet) => sheet.name.startsWith(projectName));
}
const keyword = sheetSearchValue.value.trim().toLowerCase();
@@ -155,12 +156,19 @@ const shownSheetList = computed(() => {
list = list.filter((sheet) => {
return (
sheet.name.toLowerCase().includes(keyword) ||
- sheet.statement.toLowerCase().includes(keyword)
+ new TextDecoder()
+ .decode(sheet.content.buffer)
+ .toLowerCase()
+ .includes(keyword)
);
});
}
- return list.sort((a, b) => b.updatedTs - a.updatedTs);
+ return list.sort(
+ (a, b) =>
+ (b.updateTime ?? new Date()).getTime() -
+ (a.updateTime ?? new Date()).getTime()
+ );
});
const { projectList } = useProjectV1ListByCurrentUser(false /* !showDeleted */);
@@ -185,7 +193,7 @@ const projectSelectOptions = computed(() => {
projectList.value.map((project) => {
return {
label: project.title,
- value: project.uid,
+ value: project.name,
};
})
);
@@ -205,18 +213,20 @@ const currentSheetViewMode = computed((): SheetViewMode => {
});
const fetchSheetData = async () => {
- let sheetList: Sheet[] = [];
+ await useUserStore().fetchUserList();
+
+ let sheetList: SheetV1[] = [];
if (currentSheetViewMode.value === "my") {
- sheetList = await sheetStore.fetchMySheetList();
+ sheetList = await sheetV1Store.fetchMySheetList();
} else if (currentSheetViewMode.value === "starred") {
- sheetList = await sheetStore.fetchStarredSheetList();
+ sheetList = await sheetV1Store.fetchStarredSheetList();
} else if (currentSheetViewMode.value === "shared") {
- sheetList = await sheetStore.fetchSharedSheetList();
+ sheetList = await sheetV1Store.fetchSharedSheetList();
}
// Hide those sheets from issue.
state.sheetList = sheetList.filter((sheet) => {
- return !getSheetIssueBacktracePayload(sheet);
+ return !getSheetIssueBacktracePayloadV1(sheet);
});
};
@@ -250,7 +260,7 @@ const handleSyncSheetFromVCS = () => {
return;
}
- const selectedProjectId = selectedProject.value.uid;
+ const selectedProjectName = selectedProject.value.name;
const dialogInstance = dialog.create({
title: t("sheet.hint-tips.confirm-to-sync-sheet"),
type: "info",
@@ -261,7 +271,7 @@ const handleSyncSheetFromVCS = () => {
async onPositiveClick() {
dialogInstance.closable = false;
dialogInstance.loading = true;
- await sheetStore.syncSheetFromVCS(selectedProjectId);
+ await sheetV1Store.syncSheetFromVCS(selectedProjectName);
await fetchSheetData();
dialogInstance.destroy();
},
diff --git a/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue b/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue
index 4bd9fcec69..a544c4c3bd 100644
--- a/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue
+++ b/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue
@@ -16,10 +16,13 @@ import { computed } from "vue";
import { useI18n } from "vue-i18n";
import { type DropdownOption, NDropdown, useDialog } from "naive-ui";
-import type { Sheet, SheetCreate, SheetOrganizerUpsert } from "@/types";
+import { Sheet } from "@/types/proto/v1/sheet_service";
+import type { SheetCreate, SheetOrganizerUpsert } from "@/types";
import type { SheetViewMode } from "../types";
-import { getDefaultSheetPayloadWithSource, isSheetWritable } from "@/utils";
-import { useSheetStore } from "@/store";
+import { getDefaultSheetPayloadWithSource, isSheetWritableV1 } from "@/utils";
+import { useSheetStore, useProjectV1Store } from "@/store";
+import { getProjectAndSheetId, getDatabaseId } from "@/store/modules/v1/common";
+import { useSheetV1Store } from "@/store/modules/v1/sheet";
const props = defineProps<{
view: SheetViewMode;
@@ -50,7 +53,7 @@ const options = computed(() => {
});
}
- const canDeleteSheet = isSheetWritable(sheet);
+ const canDeleteSheet = isSheetWritableV1(sheet);
if (view === "my") {
if (canDeleteSheet) {
options.push({
@@ -86,7 +89,7 @@ const handleAction = async (key: string) => {
maskClosable: false,
closeOnEsc: false,
async onPositiveClick() {
- await sheetStore.deleteSheetById(sheet.id);
+ await useSheetV1Store().deleteSheetByName(sheet.name);
dialogInstance.destroy();
},
onNegativeClick() {
@@ -97,8 +100,9 @@ const handleAction = async (key: string) => {
showIcon: true,
});
} else if (key === "star" || key === "unstar") {
+ const [_, uid] = getProjectAndSheetId(sheet.name);
const sheetOrganizerUpsert: SheetOrganizerUpsert = {
- sheeId: sheet.id,
+ sheeId: uid,
};
if (key === "star") {
@@ -118,16 +122,19 @@ const handleAction = async (key: string) => {
maskClosable: false,
closeOnEsc: false,
async onPositiveClick() {
+ const [projectId, _] = getProjectAndSheetId(sheet.name);
+ const projectV1 = useProjectV1Store().getProjectByName(projectId);
+
const sheetCreate: SheetCreate = {
- projectId: sheet.projectId,
- name: sheet.name,
- statement: sheet.statement,
+ projectId: projectV1.uid,
+ name: sheet.title,
+ statement: new TextDecoder().decode(sheet.content.buffer),
visibility: "PRIVATE",
payload: getDefaultSheetPayloadWithSource("BYTEBASE"),
source: "BYTEBASE",
};
- if (sheet.databaseId) {
- sheetCreate.databaseId = sheet.databaseId;
+ if (sheet.database) {
+ sheetCreate.databaseId = getDatabaseId(sheet.database);
}
await sheetStore.createSheet(sheetCreate);
dialogInstance.destroy();
diff --git a/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue b/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue
index 54960a4805..a682dfb3b5 100644
--- a/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue
+++ b/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue
@@ -15,7 +15,7 @@
</div>
<div
v-for="sheet in sheetList"
- :key="sheet.id"
+ :key="sheet.name"
class="sheet-list-container text-sm cursor-pointer hover:bg-gray-100"
:class="view"
@click="handleSheetClick(sheet)"
@@ -48,11 +48,13 @@ import { computed } from "vue";
import { useI18n } from "vue-i18n";
import dayjs from "dayjs";
-import type { Sheet } from "@/types";
+import { Sheet } from "@/types/proto/v1/sheet_service";
+import { getProjectAndSheetId } from "@/store/modules/v1/common";
import { SheetViewMode } from "../types";
import Dropdown from "./Dropdown.vue";
import { useRouter } from "vue-router";
-import { sheetSlug } from "@/utils";
+import { sheetSlugV1 } from "@/utils";
+import { useUserStore } from "@/store";
const props = withDefaults(
defineProps<{
@@ -81,7 +83,7 @@ const handleSheetClick = (sheet: Sheet) => {
router.push({
name: "sql-editor.share",
params: {
- sheetSlug: sheetSlug(sheet),
+ sheetSlug: sheetSlugV1(sheet),
},
});
};
@@ -118,14 +120,15 @@ const headers = computed(() => {
});
const getValueList = (sheet: Sheet) => {
+ const [projName, _] = getProjectAndSheetId(sheet.name);
const valueList = [
{
key: "name",
- value: sheet.name,
+ value: sheet.title,
},
{
key: "project",
- value: sheet.project.name,
+ value: projName,
},
{
key: "visibility",
@@ -136,13 +139,17 @@ const getValueList = (sheet: Sheet) => {
if (showCreator.value) {
valueList.push({
key: "creator",
- value: sheet.creator.name,
+ value:
+ useUserStore().getUserByIdentifier(sheet.creator)?.title ??
+ sheet.creator,
});
}
valueList.push({
key: "updated",
- value: dayjs.duration(sheet.updatedTs * 1000 - Date.now()).humanize(true),
+ value: dayjs
+ .duration((sheet.updateTime ?? new Date()).getTime() - Date.now())
+ .humanize(true),
});
return valueList;
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 96d7a525f0..a37db0a42c 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -4881,7 +4881,7 @@ TYPE_PROJECT_REPOSITORY_PUSH represents Bytebase receiving a push event from the
| flow | [ApprovalFlow](#bytebase-v1-ApprovalFlow) | | |
| title | [string](#string) | | |
| description | [string](#string) | | |
-| creator | [string](#string) | | The name of the creator in users/{email} format. |
+| creator | [string](#string) | | The name of the creator in users/{email} format. TODO: we should mark it as OUTPUT_ONLY, but currently the frontend will post the approval setting with creator. |
@@ -6689,6 +6689,7 @@ When paginating, all other parameters provided to `SearchSheets` must match the
| source | [Sheet.Source](#bytebase-v1-Sheet-Source) | | The source of the sheet. |
| type | [Sheet.Type](#bytebase-v1-Sheet-Type) | | The type of the sheet. |
| starred | [bool](#bool) | | starred indicates whether the sheet is starred by the current authenticated user. |
+| payload | [string](#string) | | TODO: deprecate this field. |
diff --git a/proto/generated-go/v1/review_service.pb.go b/proto/generated-go/v1/review_service.pb.go
index 4c29f50ee9..3c5129abcd 100644
--- a/proto/generated-go/v1/review_service.pb.go
+++ b/proto/generated-go/v1/review_service.pb.go
@@ -864,6 +864,7 @@ type ApprovalTemplate struct {
Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
// The name of the creator in users/{email} format.
+ // TODO: we should mark it as OUTPUT_ONLY, but currently the frontend will post the approval setting with creator.
Creator string `protobuf:"bytes,4,opt,name=creator,proto3" json:"creator,omitempty"`
}
diff --git a/proto/generated-go/v1/sheet_service.pb.go b/proto/generated-go/v1/sheet_service.pb.go
index 9b4f678b51..1cf0277456 100644
--- a/proto/generated-go/v1/sheet_service.pb.go
+++ b/proto/generated-go/v1/sheet_service.pb.go
@@ -650,6 +650,8 @@ type Sheet struct {
Type Sheet_Type `protobuf:"varint,11,opt,name=type,proto3,enum=bytebase.v1.Sheet_Type" json:"type,omitempty"`
// starred indicates whether the sheet is starred by the current authenticated user.
Starred bool `protobuf:"varint,12,opt,name=starred,proto3" json:"starred,omitempty"`
+ // TODO: deprecate this field.
+ Payload string `protobuf:"bytes,13,opt,name=payload,proto3" json:"payload,omitempty"`
}
func (x *Sheet) Reset() {
@@ -768,6 +770,13 @@ func (x *Sheet) GetStarred() bool {
return false
}
+func (x *Sheet) GetPayload() string {
+ if x != nil {
+ return x.Payload
+ }
+ return ""
+}
+
var File_v1_sheet_service_proto protoreflect.FileDescriptor
var file_v1_sheet_service_proto_rawDesc = []byte{
@@ -824,7 +833,7 @@ var file_v1_sheet_service_proto_rawDesc = []byte{
0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x2b, 0x0a, 0x11, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65,
0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72,
0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e,
- 0x74, 0x22, 0xbb, 0x06, 0x0a, 0x05, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x04, 0x6e,
+ 0x74, 0x22, 0xd5, 0x06, 0x0a, 0x05, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1a, 0x0a, 0x04, 0x6e,
0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x06, 0xe0, 0x41, 0x02, 0xe0, 0x41,
0x05, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62,
0x61, 0x73, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62,
@@ -857,76 +866,77 @@ var file_v1_sheet_service_proto_rawDesc = []byte{
0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x42, 0x03, 0xe0, 0x41, 0x02,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74, 0x61, 0x72, 0x72, 0x65,
0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x74, 0x61, 0x72, 0x72, 0x65, 0x64,
- 0x22, 0x6f, 0x0a, 0x0a, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a,
- 0x0a, 0x16, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53,
- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x49,
- 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10,
- 0x01, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f,
- 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43, 0x54, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53,
- 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10,
- 0x03, 0x22, 0x8f, 0x01, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12,
- 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
- 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42,
- 0x59, 0x54, 0x45, 0x42, 0x41, 0x53, 0x45, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x55,
- 0x52, 0x43, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x41, 0x52, 0x54,
- 0x49, 0x46, 0x41, 0x43, 0x54, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43,
- 0x45, 0x5f, 0x47, 0x49, 0x54, 0x4c, 0x41, 0x42, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f,
- 0x55, 0x52, 0x43, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x04, 0x12, 0x14, 0x0a,
- 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x49, 0x54, 0x42, 0x55, 0x43, 0x4b, 0x45,
- 0x54, 0x10, 0x05, 0x22, 0x2a, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
- 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x51, 0x4c, 0x10, 0x01, 0x32,
- 0x84, 0x06, 0x0a, 0x0c, 0x53, 0x68, 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
- 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74,
- 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43,
- 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x3c, 0xda, 0x41, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,
- 0x2c, 0x73, 0x68, 0x65, 0x65, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x05, 0x73, 0x68,
- 0x65, 0x65, 0x74, 0x22, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,
- 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65,
- 0x65, 0x74, 0x73, 0x12, 0x6b, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12,
- 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
- 0x74, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e,
- 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65,
- 0x74, 0x22, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20,
- 0x12, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a,
- 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d,
- 0x12, 0x82, 0x01, 0x0a, 0x0c, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74,
- 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e,
- 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
- 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25,
- 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a,
- 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73,
- 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x8b, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65,
- 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65,
- 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73,
- 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x47, 0xda, 0x41, 0x11, 0x73,
- 0x68, 0x65, 0x65, 0x74, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b,
- 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x3a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x32, 0x24, 0x2f,
- 0x76, 0x31, 0x2f, 0x7b, 0x73, 0x68, 0x65, 0x65, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70,
- 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73,
- 0x2f, 0x2a, 0x7d, 0x12, 0x75, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65,
- 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, 0xda, 0x41, 0x04,
- 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x2a, 0x1e, 0x2f, 0x76, 0x31, 0x2f,
+ 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x6f, 0x0a, 0x0a, 0x56, 0x69,
+ 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x16, 0x56, 0x49, 0x53, 0x49,
+ 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
+ 0x45, 0x44, 0x10, 0x00, 0x12, 0x15, 0x0a, 0x11, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49,
+ 0x54, 0x59, 0x5f, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x56,
+ 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54, 0x59, 0x5f, 0x50, 0x52, 0x4f, 0x4a, 0x45, 0x43,
+ 0x54, 0x10, 0x02, 0x12, 0x16, 0x0a, 0x12, 0x56, 0x49, 0x53, 0x49, 0x42, 0x49, 0x4c, 0x49, 0x54,
+ 0x59, 0x5f, 0x50, 0x52, 0x49, 0x56, 0x41, 0x54, 0x45, 0x10, 0x03, 0x22, 0x8f, 0x01, 0x0a, 0x06,
+ 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45,
+ 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13,
+ 0x0a, 0x0f, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x59, 0x54, 0x45, 0x42, 0x41, 0x53,
+ 0x45, 0x10, 0x01, 0x12, 0x1c, 0x0a, 0x18, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x42, 0x59,
+ 0x54, 0x45, 0x42, 0x41, 0x53, 0x45, 0x5f, 0x41, 0x52, 0x54, 0x49, 0x46, 0x41, 0x43, 0x54, 0x10,
+ 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x47, 0x49, 0x54, 0x4c,
+ 0x41, 0x42, 0x10, 0x03, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x4f, 0x55, 0x52, 0x43, 0x45, 0x5f, 0x47,
+ 0x49, 0x54, 0x48, 0x55, 0x42, 0x10, 0x04, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x4f, 0x55, 0x52, 0x43,
+ 0x45, 0x5f, 0x42, 0x49, 0x54, 0x42, 0x55, 0x43, 0x4b, 0x45, 0x54, 0x10, 0x05, 0x22, 0x2a, 0x0a,
+ 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,
+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x54,
+ 0x59, 0x50, 0x45, 0x5f, 0x53, 0x51, 0x4c, 0x10, 0x01, 0x32, 0x84, 0x06, 0x0a, 0x0c, 0x53, 0x68,
+ 0x65, 0x65, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x43,
+ 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62, 0x79, 0x74,
+ 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
+ 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x22,
+ 0x3c, 0xda, 0x41, 0x0c, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x2c, 0x73, 0x68, 0x65, 0x65, 0x74,
+ 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x3a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x22, 0x1e, 0x2f,
+ 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65,
+ 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x6b, 0x0a,
+ 0x08, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x62, 0x79, 0x74, 0x65,
+ 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x68, 0x65, 0x65, 0x74,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
+ 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x22, 0x2d, 0xda, 0x41, 0x04,
+ 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x76, 0x31, 0x2f,
0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a,
- 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7a, 0x0a, 0x0a, 0x53, 0x79,
- 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
- 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65, 0x74,
- 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
- 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
- 0x22, 0x34, 0xda, 0x41, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02,
- 0x25, 0x22, 0x23, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70,
- 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74,
- 0x73, 0x3a, 0x73, 0x79, 0x6e, 0x63, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61,
- 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x33,
+ 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x82, 0x01, 0x0a, 0x0c, 0x53,
+ 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x20, 0x2e, 0x62, 0x79,
+ 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68,
+ 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e,
+ 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72,
+ 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x22, 0x2d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x27, 0x12, 0x25, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70,
+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a,
+ 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12,
+ 0x8b, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12,
+ 0x1f, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x55, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,
+ 0x68, 0x65, 0x65, 0x74, 0x22, 0x47, 0xda, 0x41, 0x11, 0x73, 0x68, 0x65, 0x65, 0x74, 0x2c, 0x75,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d,
+ 0x3a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x32, 0x24, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x73, 0x68,
+ 0x65, 0x65, 0x74, 0x2e, 0x6e, 0x61, 0x6d, 0x65, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
+ 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x75, 0x0a,
+ 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x12, 0x1f, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
+ 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
+ 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
+ 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x2d, 0xda, 0x41, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x82, 0xd3,
+ 0xe4, 0x93, 0x02, 0x20, 0x2a, 0x1e, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x3d,
+ 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74,
+ 0x73, 0x2f, 0x2a, 0x7d, 0x12, 0x7a, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65,
+ 0x74, 0x73, 0x12, 0x1e, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
+ 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0x34, 0xda, 0x41, 0x06, 0x70,
+ 0x61, 0x72, 0x65, 0x6e, 0x74, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x25, 0x22, 0x23, 0x2f, 0x76, 0x31,
+ 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
+ 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x3a, 0x73, 0x79, 0x6e, 0x63,
+ 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f,
+ 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/v1/sheet_service.proto b/proto/v1/sheet_service.proto
index 8e689556a0..759d054394 100644
--- a/proto/v1/sheet_service.proto
+++ b/proto/v1/sheet_service.proto
@@ -203,4 +203,7 @@ message Sheet {
// starred indicates whether the sheet is starred by the current authenticated user.
bool starred = 12;
+
+ // TODO: deprecate this field.
+ string payload = 13;
}