Skip to content

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

chore: migrate create & update sheet and sheet organizer (#6275)

ecmadaofdd1799153f5
diff --git a/backend/api/v1/sheet_service.go b/backend/api/v1/sheet_service.go
index 46bbba2326..b3534680dd 100644
--- a/backend/api/v1/sheet_service.go
+++ b/backend/api/v1/sheet_service.go
@@ -80,11 +80,22 @@ func (s *SheetService) CreateSheet(ctx context.Context, request *v1pb.CreateShee
return nil, status.Errorf(codes.NotFound, fmt.Sprintf("instance with resource id %q not found", instanceResourceID))
}
- database, err := s.store.GetDatabaseV2(ctx, &store.FindDatabaseMessage{
- ProjectID: &projectResourceID,
- InstanceID: &instanceResourceID,
- DatabaseName: &databaseName,
- })
+ find := &store.FindDatabaseMessage{
+ ProjectID: &projectResourceID,
+ InstanceID: &instanceResourceID,
+ }
+ // It's chaos. We return /instance/{resource id}/databases/{uid} database in find sheet request,
+ // but the frontend use both /instance/{resource id}/databases/{uid} and /instance/{resource id}/databases/{name}, sometimes the name will convert to int id incorrectly.
+ // For database v1 api, we should only use the /instance/{resource id}/databases/{name}
+ // We need to remove legacy code after the migration.
+ dbUID, isNumber := isNumber(databaseName)
+ if isNumber {
+ find.UID = &dbUID
+ } else {
+ find.DatabaseName = &databaseName
+ }
+
+ database, err := s.store.GetDatabaseV2(ctx, find)
if err != nil {
return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to get database with name %q, err: %s", databaseName, err.Error()))
}
@@ -119,25 +130,32 @@ func (s *SheetService) GetSheet(ctx context.Context, request *v1pb.GetSheetReque
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid sheet id %s, must be positive integer", sheetID))
}
- project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{
- ResourceID: &projectResourceID,
- })
- if err != nil {
- return nil, status.Errorf(codes.NotFound, fmt.Sprintf("project with resource id %s not found", projectResourceID))
- }
- if project == nil {
- return nil, status.Errorf(codes.NotFound, fmt.Sprintf("project with resource id %s not found", projectResourceID))
+ find := &api.SheetFind{
+ ID: &sheetIntID,
+ LoadFull: request.Raw,
}
- if project.Deleted {
- return nil, status.Errorf(codes.NotFound, fmt.Sprintf("project with resource id %q had deleted", projectResourceID))
+
+ // this allows get the sheet only by the id: /projects/-/sheets/{sheet uid}.
+ // so that we can easily get the sheet from the issue.
+ // we can remove this after migrate the issue to v1 API.
+ if projectResourceID != "-" {
+ project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{
+ ResourceID: &projectResourceID,
+ })
+ if err != nil {
+ return nil, status.Errorf(codes.NotFound, fmt.Sprintf("project with resource id %s not found", projectResourceID))
+ }
+ if project == nil {
+ return nil, status.Errorf(codes.NotFound, fmt.Sprintf("project with resource id %s not found", projectResourceID))
+ }
+ if project.Deleted {
+ return nil, status.Errorf(codes.NotFound, fmt.Sprintf("project with resource id %q had deleted", projectResourceID))
+ }
+ find.ProjectID = &project.UID
}
currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)
- sheet, err := s.store.GetSheetV2(ctx, &api.SheetFind{
- ID: &sheetIntID,
- LoadFull: request.Raw,
- ProjectID: &project.UID,
- }, currentPrincipalID)
+ sheet, err := s.store.GetSheetV2(ctx, find, currentPrincipalID)
if err != nil {
return nil, status.Errorf(codes.Internal, fmt.Sprintf("failed to get sheet: %v", err))
}
@@ -327,7 +345,7 @@ func (s *SheetService) UpdateSheet(ctx context.Context, request *v1pb.UpdateShee
stringVisibility := string(visibility)
sheetPatch.Visibility = &stringVisibility
case "payload":
- sheetPatch.Name = &request.Sheet.Payload
+ sheetPatch.Payload = &request.Sheet.Payload
default:
return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid update mask path %q", path))
}
@@ -601,6 +619,44 @@ func (s *SheetService) SyncSheets(ctx context.Context, request *v1pb.SyncSheetsR
return &emptypb.Empty{}, nil
}
+// UpdateSheetOrganizer upsert the sheet organizer.
+func (s *SheetService) UpdateSheetOrganizer(ctx context.Context, request *v1pb.UpdateSheetOrganizerRequest) (*v1pb.SheetOrganizer, error) {
+ _, sheetID, err := getProjectResourceIDSheetID(request.Organizer.Sheet)
+ if err != nil {
+ return nil, status.Errorf(codes.InvalidArgument, err.Error())
+ }
+ sheetIntID, err := strconv.Atoi(sheetID)
+ if err != nil || sheetIntID <= 0 {
+ return nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid sheet id %s, must be positive integer", sheetID))
+ }
+
+ currentPrincipalID := ctx.Value(common.PrincipalIDContextKey).(int)
+ sheetOrganizerUpsert := &api.SheetOrganizerUpsert{
+ SheetID: sheetIntID,
+ PrincipalID: currentPrincipalID,
+ }
+
+ for _, path := range request.UpdateMask.Paths {
+ switch path {
+ case "starred":
+ sheetOrganizerUpsert.Starred = request.Organizer.Starred
+ case "pinned":
+ sheetOrganizerUpsert.Pinned = request.Organizer.Pinned
+ }
+ }
+
+ organizer, err := s.store.UpsertSheetOrganizer(ctx, sheetOrganizerUpsert)
+ if err != nil {
+ return nil, status.Errorf(codes.Internal, "failed to upsert organizer for sheet %s with error: %v", request.Organizer.Sheet, err)
+ }
+
+ return &v1pb.SheetOrganizer{
+ Sheet: request.Organizer.Sheet,
+ Starred: organizer.Starred,
+ Pinned: organizer.Pinned,
+ }, nil
+}
+
func (s *SheetService) convertToAPISheetMessage(ctx context.Context, sheet *store.SheetMessage) (*v1pb.Sheet, error) {
databaseParent := ""
if sheet.DatabaseID != nil {
diff --git a/backend/server/acl_casbin_policy_dba.csv b/backend/server/acl_casbin_policy_dba.csv
index 2aaa46155b..21648b0815 100644
--- a/backend/server/acl_casbin_policy_dba.csv
+++ b/backend/server/acl_casbin_policy_dba.csv
@@ -109,7 +109,6 @@ p, DBA, /sheet/starred, GET
p, DBA, /sheet/{sheetID}, GET
p, DBA, /sheet/{sheetID}, PATCH
p, DBA, /sheet/{sheetID}, DELETE
-p, DBA, /sheet/{sheetID}/organizer, PATCH
p, DBA, /debug, GET
p, DBA, /debug, PATCH
p, DBA, /debug/log, GET
diff --git a/backend/server/acl_casbin_policy_developer.csv b/backend/server/acl_casbin_policy_developer.csv
index 03bf1459b2..e8dba8d473 100644
--- a/backend/server/acl_casbin_policy_developer.csv
+++ b/backend/server/acl_casbin_policy_developer.csv
@@ -93,7 +93,6 @@ p, DEVELOPER, /sheet/starred, GET
p, DEVELOPER, /sheet/{sheetID}, GET
p, DEVELOPER, /sheet/{sheetID}, PATCH
p, DEVELOPER, /sheet/{sheetID}, DELETE
-p, DEVELOPER, /sheet/{sheetID}/organizer, PATCH
p, DEVELOPER, /debug, GET
p, DEVELOPER, /debug/log, GET
p, DEVELOPER, /anomaly, GET
diff --git a/backend/server/acl_casbin_policy_owner.csv b/backend/server/acl_casbin_policy_owner.csv
index ddae14e221..491615414b 100644
--- a/backend/server/acl_casbin_policy_owner.csv
+++ b/backend/server/acl_casbin_policy_owner.csv
@@ -116,7 +116,6 @@ p, OWNER, /sheet/starred, GET
p, OWNER, /sheet/{sheetID}, GET
p, OWNER, /sheet/{sheetID}, PATCH
p, OWNER, /sheet/{sheetID}, DELETE
-p, OWNER, /sheet/{sheetID}/organizer, PATCH
p, OWNER, /debug, GET
p, OWNER, /debug, PATCH
p, OWNER, /debug/log, GET
diff --git a/backend/server/server.go b/backend/server/server.go
index 439eba2ee6..f2368ca204 100644
--- a/backend/server/server.go
+++ b/backend/server/server.go
@@ -524,7 +524,6 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {
s.registerVCSRoutes(apiGroup)
s.registerPlanRoutes(apiGroup)
s.registerSheetRoutes(apiGroup)
- s.registerSheetOrganizerRoutes(apiGroup)
s.registerAnomalyRoutes(apiGroup)
// Register healthz endpoint.
diff --git a/backend/server/sheet_organizer.go b/backend/server/sheet_organizer.go
deleted file mode 100644
index b5430f78cb..0000000000
--- a/backend/server/sheet_organizer.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package server
-
-import (
- "fmt"
- "net/http"
- "strconv"
-
- "github.com/google/jsonapi"
- "github.com/labstack/echo/v4"
-
- api "github.com/bytebase/bytebase/backend/legacyapi"
-)
-
-func (s *Server) registerSheetOrganizerRoutes(g *echo.Group) {
- g.PATCH("/sheet/:sheetID/organizer", func(c echo.Context) error {
- ctx := c.Request().Context()
- sheetID, err := strconv.Atoi(c.Param("sheetID"))
- if err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Sheet ID is not a number: %s", c.Param("sheetID"))).SetInternal(err)
- }
-
- principalID := c.Get(getPrincipalIDContextKey()).(int)
- sheetOrganizerUpsert := &api.SheetOrganizerUpsert{
- SheetID: sheetID,
- PrincipalID: principalID,
- }
- if err := jsonapi.UnmarshalPayload(c.Request().Body, sheetOrganizerUpsert); err != nil {
- return echo.NewHTTPError(http.StatusBadRequest, "Malformed patch sheet organizer request").SetInternal(err)
- }
-
- if _, err := s.store.UpsertSheetOrganizer(ctx, sheetOrganizerUpsert); err != nil {
- return echo.NewHTTPError(http.StatusInternalServerError, fmt.Sprintf("Failed to upsert organizer %d to sheet %d", principalID, sheetID)).SetInternal(err)
- }
-
- c.Response().Header().Set(echo.HeaderContentType, echo.MIMEApplicationJSONCharsetUTF8)
- c.Response().WriteHeader(http.StatusOK)
- return nil
- })
-}
diff --git a/backend/store/sheet.go b/backend/store/sheet.go
index ebaf925b46..319db1e0c3 100644
--- a/backend/store/sheet.go
+++ b/backend/store/sheet.go
@@ -853,8 +853,8 @@ func (s *Store) CreateSheetV2(ctx context.Context, create *SheetMessage) (*Sheet
type,
payload
)
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
- RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, project_id, database_id, name, LEFT(statement, %d), visibility, source, type, LENGTH(statement)
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
+ RETURNING id, row_status, creator_id, created_ts, updater_id, updated_ts, project_id, database_id, name, LEFT(statement, %d), visibility, source, type, LENGTH(statement), payload
`, common.MaxSheetSize)
tx, err := s.db.BeginTx(ctx, nil)
diff --git a/frontend/src/components/Issue/IssueTaskStatementPanel.vue b/frontend/src/components/Issue/IssueTaskStatementPanel.vue
index df19d0eb0a..e7985d4f94 100644
--- a/frontend/src/components/Issue/IssueTaskStatementPanel.vue
+++ b/frontend/src/components/Issue/IssueTaskStatementPanel.vue
@@ -120,7 +120,6 @@
</template>
<script lang="ts" setup>
-import { isNumber } from "lodash-es";
import { useDialog } from "naive-ui";
import { onMounted, reactive, watch, computed, ref, nextTick } from "vue";
import { useI18n } from "vue-i18n";
@@ -128,7 +127,6 @@ import {
hasFeature,
pushNotification,
useDBSchemaStore,
- useSheetStore,
useUIStateStore,
useDatabaseStore,
useSheetV1Store,
@@ -138,7 +136,6 @@ import {
Database,
dialectOfEngine,
Issue,
- SheetCreate,
SQLDialect,
Task,
TaskCreate,
@@ -154,7 +151,15 @@ import { TableMetadata } from "@/types/proto/store/database";
import MonacoEditor from "../MonacoEditor/MonacoEditor.vue";
import { useSQLAdviceMarkers } from "./logic/useSQLAdviceMarkers";
import UploadProgressButton from "../misc/UploadProgressButton.vue";
-import { getSheetPathByLegacyProject } from "@/store/modules/v1/common";
+import {
+ getSheetPathByLegacyProject,
+ getProjectPathByLegacyProject,
+} from "@/store/modules/v1/common";
+import {
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+} from "@/types/proto/v1/sheet_service";
interface LocalState {
taskSheetName?: string;
@@ -196,7 +201,6 @@ const { t } = useI18n();
const overrideSQLDialog = useDialog();
const uiStateStore = useUIStateStore();
const dbSchemaStore = useDBSchemaStore();
-const sheetStore = useSheetStore();
const sheetV1Store = useSheetV1Store();
const editorRef = ref<InstanceType<typeof MonacoEditor>>();
@@ -334,12 +338,19 @@ const formatOnSave = computed({
const allowFormatOnSave = computed(() => language.value === "sql");
-const isTaskSheetOversize = computed(() => {
+const isValidSheetName = computed(() => {
if (!state.taskSheetName) {
return false;
}
+ return sheetV1Store.getSheetUid(state.taskSheetName) !== UNKNOWN_ID;
+});
- const taskSheet = sheetV1Store.getSheetByName(state.taskSheetName);
+const isTaskSheetOversize = computed(() => {
+ if (!isValidSheetName.value) {
+ return false;
+ }
+
+ const taskSheet = sheetV1Store.getSheetByName(state.taskSheetName!);
if (!taskSheet) {
return false;
}
@@ -426,7 +437,7 @@ watch(
watch(
() => state.taskSheetName,
async () => {
- if (state.taskSheetName) {
+ if (isValidSheetName.value) {
state.editStatement = await getOrFetchSheetStatementByName(
state.taskSheetName
);
@@ -482,39 +493,31 @@ const handleUploadFile = async (event: Event, tick: (p: number) => void) => {
}
state.isUploadingFile = true;
- const projectId = selectedDatabase.value.projectId;
+ const projectName = getProjectPathByLegacyProject(
+ selectedDatabase.value.project
+ );
const { filename, content: statement } = await handleUploadFileEvent(
event,
100
);
const uploadStatementAsSheet = async (statement: string) => {
- const sheetCreate: SheetCreate = {
- projectId: projectId,
- name: filename,
- statement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: {},
- };
+ let payload = {};
if (!create.value) {
- sheetCreate.payload = getBacktracePayloadWithIssue(issue.value as Issue);
+ payload = getBacktracePayloadWithIssue(issue.value as Issue);
}
- const sheet = await sheetStore.createSheet(sheetCreate, {
- timeout: 10 * 60 * 1000, // 10 minutes
- onUploadProgress: (event) => {
- console.debug("upload progress", event);
- const progress = event.progress;
- if (isNumber(progress)) {
- tick(progress * 100);
- } else {
- tick(-1); // -1 to show a simple spinner instead of progress
- }
- },
+ // TODO: upload process
+ const sheet = await sheetV1Store.createSheet(projectName, {
+ title: filename,
+ content: new TextEncoder().encode(statement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: JSON.stringify(payload),
});
state.isUploadingFile = false;
- updateSheetId(sheet.id);
+ updateSheetId(sheetV1Store.getSheetUid(sheet.name));
await updateStatement(statement);
state.editing = false;
if (selectedTask.value) {
diff --git a/frontend/src/components/Issue/activity/ActionSentence.vue b/frontend/src/components/Issue/activity/ActionSentence.vue
index 376a8211b9..76e006f1dc 100644
--- a/frontend/src/components/Issue/activity/ActionSentence.vue
+++ b/frontend/src/components/Issue/activity/ActionSentence.vue
@@ -17,14 +17,13 @@ import {
ActivityTaskStatusUpdatePayload,
Issue,
SYSTEM_BOT_ID,
- UNKNOWN_ID,
} from "@/types";
import {
findStageById,
findTaskById,
issueActivityActionSentence,
} from "@/utils";
-import { useSheetStore, useSheetById } from "@/store";
+import { useSheetV1Store, useSheetStatementByUid } from "@/store";
import TaskName from "./TaskName.vue";
import SQLPreviewPopover from "@/components/misc/SQLPreviewPopover.vue";
import StageName from "./StageName.vue";
@@ -43,7 +42,7 @@ const props = defineProps({
});
const { t } = useI18n();
-const sheetStore = useSheetStore();
+const sheetV1Store = useSheetV1Store();
const renderActionSentence = () => {
const renderSpan = (content: string, props?: object) => {
@@ -184,10 +183,10 @@ const renderActionSentence = () => {
case "bb.pipeline.task.statement.update": {
const payload = activity.payload as ActivityTaskStatementUpdatePayload;
const oldStatement =
- useSheetById(payload.oldSheetId || UNKNOWN_ID).value.statement ||
+ useSheetStatementByUid(payload.oldSheetId).value ||
payload.oldStatement;
const newStatement =
- useSheetById(payload.newSheetId || UNKNOWN_ID).value.statement ||
+ useSheetStatementByUid(payload.newSheetId).value ||
payload.newStatement;
return h(
"span",
@@ -275,10 +274,10 @@ watch(
const activity = props.activity;
// Prepare sheet data for renderering.
if (activity.type === "bb.pipeline.task.statement.update") {
- sheetStore.getOrFetchSheetById(
+ sheetV1Store.getOrFetchSheetByUid(
(activity.payload as ActivityTaskStatementUpdatePayload).newSheetId
);
- sheetStore.getOrFetchSheetById(
+ sheetV1Store.getOrFetchSheetByUid(
(activity.payload as ActivityTaskStatementUpdatePayload).oldSheetId
);
}
diff --git a/frontend/src/components/Issue/logic/GhostModeProvider.ts b/frontend/src/components/Issue/logic/GhostModeProvider.ts
index 333cbad943..cfcd58a7b2 100644
--- a/frontend/src/components/Issue/logic/GhostModeProvider.ts
+++ b/frontend/src/components/Issue/logic/GhostModeProvider.ts
@@ -20,11 +20,17 @@ import {
} from "@/types";
import {
useDatabaseStore,
- useSheetStore,
- useSheetById,
+ useSheetV1Store,
+ useSheetStatementByUid,
useTaskStore,
} from "@/store";
import { sheetIdOfTask } from "@/utils";
+import { getProjectPathByLegacyProject } from "@/store/modules/v1/common";
+import {
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+} from "@/types/proto/v1/sheet_service";
export default defineComponent({
name: "GhostModeProvider",
@@ -42,6 +48,7 @@ export default defineComponent({
} = useIssueLogic();
const databaseStore = useDatabaseStore();
const taskStore = useTaskStore();
+ const sheetV1Store = useSheetV1Store();
const selectedStatement = computed(() => {
if (isTenantMode.value) {
@@ -50,14 +57,14 @@ export default defineComponent({
const issueCreate = issue.value as IssueCreate;
const context = issueCreate.createContext as MigrationContext;
return (
- useSheetById(context.detailList[0].sheetId).value?.statement || ""
+ useSheetStatementByUid(context.detailList[0].sheetId).value || ""
);
} else {
const issueEntity = issue.value as Issue;
const task = issueEntity.pipeline.stageList[0].taskList[0];
const payload =
task.payload as TaskDatabaseSchemaUpdateGhostSyncPayload;
- return useSheetById(payload.sheetId).value?.statement || "";
+ return useSheetStatementByUid(payload.sheetId).value || "";
}
} else {
// In standard pipeline, each ghost-sync task can hold its own
@@ -68,14 +75,14 @@ export default defineComponent({
let statement = (task as TaskCreate).statement;
if ((task as TaskCreate).sheetId !== UNKNOWN_ID) {
statement =
- useSheetById((task as TaskCreate).sheetId).value?.statement ||
+ useSheetStatementByUid((task as TaskCreate).sheetId).value ||
"";
}
return statement;
} else {
return (
- useSheetById(sheetIdOfTask(task as Task) || UNKNOWN_ID).value
- ?.statement || ""
+ useSheetStatementByUid(sheetIdOfTask(task as Task) || UNKNOWN_ID)
+ .value || ""
);
}
} else {
@@ -169,16 +176,19 @@ export default defineComponent({
const db = databaseStore.getDatabaseById(detail.databaseId!);
if (!detail.sheetId || detail.sheetId === UNKNOWN_ID) {
const statement = maybeFormatStatementOnSave(detail.statement, db);
- const sheet = await useSheetStore().createSheet({
- projectId: issueCreate.projectId,
- name: issueCreate.name + " - " + db.name,
- statement: statement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: {},
- });
+ const sheet = await sheetV1Store.createSheet(
+ getProjectPathByLegacyProject(db.project),
+ {
+ title: issueCreate.name + " - " + db.name,
+ content: new TextEncoder().encode(statement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
+ }
+ );
detail.statement = "";
- detail.sheetId = sheet.id;
+ detail.sheetId = sheetV1Store.getSheetUid(sheet.name);
}
}
} else {
@@ -201,16 +211,19 @@ export default defineComponent({
const db = databaseStore.getDatabaseById(databaseId);
if (!detail.sheetId || detail.sheetId === UNKNOWN_ID) {
const statement = maybeFormatStatementOnSave(task.statement, db);
- const sheet = await useSheetStore().createSheet({
- projectId: issueCreate.projectId,
- name: issueCreate.name + " - " + db.name,
- statement: statement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: {},
- });
+ const sheet = await sheetV1Store.createSheet(
+ getProjectPathByLegacyProject(db.project),
+ {
+ title: issueCreate.name + " - " + db.name,
+ content: new TextEncoder().encode(statement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
+ }
+ );
detail.statement = "";
- detail.sheetId = sheet.id;
+ detail.sheetId = sheetV1Store.getSheetUid(sheet.name);
}
detail.earliestAllowedTs = task.earliestAllowedTs;
}
diff --git a/frontend/src/components/Issue/logic/TenantModeProvider.ts b/frontend/src/components/Issue/logic/TenantModeProvider.ts
index a731c38c26..59fc844610 100644
--- a/frontend/src/components/Issue/logic/TenantModeProvider.ts
+++ b/frontend/src/components/Issue/logic/TenantModeProvider.ts
@@ -2,9 +2,10 @@ import { computed, defineComponent } from "vue";
import { cloneDeep, head } from "lodash-es";
import {
useDatabaseStore,
- useSheetStore,
+ useSheetV1Store,
+ useProjectV1Store,
useTaskStore,
- useSheetById,
+ useSheetStatementByUid,
} from "@/store";
import {
Issue,
@@ -25,6 +26,12 @@ import {
} from "./common";
import { provideIssueLogic, useIssueLogic } from "./index";
import { getBacktracePayloadWithIssue, sheetIdOfTask } from "@/utils";
+import { getProjectPathByLegacyProject } from "@/store/modules/v1/common";
+import {
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+} from "@/types/proto/v1/sheet_service";
export default defineComponent({
name: "TenantModeProvider",
@@ -32,7 +39,8 @@ export default defineComponent({
const { create, issue, selectedTask, createIssue, onStatusChanged } =
useIssueLogic();
const databaseStore = useDatabaseStore();
- const sheetStore = useSheetStore();
+ const sheetV1Store = useSheetV1Store();
+ const projectV1Store = useProjectV1Store();
const taskStore = useTaskStore();
const allowEditStatement = computed(() => {
@@ -55,8 +63,9 @@ export default defineComponent({
const payload = task.payload as TaskDatabaseSchemaUpdatePayload;
const selectedTaskSheetId = sheetIdOfTask(selectedTask.value as Task);
return (
- useSheetById(selectedTaskSheetId || payload.sheetId || UNKNOWN_ID)
- .value?.statement || ""
+ useSheetStatementByUid(
+ selectedTaskSheetId || payload.sheetId || UNKNOWN_ID
+ ).value || ""
);
}
});
@@ -77,15 +86,20 @@ export default defineComponent({
);
} else {
const issueEntity = issue.value as Issue;
- const sheet = await sheetStore.createSheet({
- projectId: issueEntity.project.id,
- name: `Sheet for issue #${issueEntity.id}`,
- statement: newStatement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: getBacktracePayloadWithIssue(issue.value as Issue),
- });
- updateSheetId(sheet.id);
+ const sheet = await sheetV1Store.createSheet(
+ getProjectPathByLegacyProject(issueEntity.project),
+ {
+ title: `Sheet for issue #${issueEntity.id}`,
+ content: new TextEncoder().encode(newStatement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: JSON.stringify(
+ getBacktracePayloadWithIssue(issue.value as Issue)
+ ),
+ }
+ );
+ updateSheetId(sheetV1Store.getSheetUid(sheet.name));
}
};
@@ -140,16 +154,19 @@ export default defineComponent({
const db = databaseStore.getDatabaseById(detail.databaseId!);
if (!detail.sheetId || detail.sheetId === UNKNOWN_ID) {
const statement = maybeFormatStatementOnSave(detail.statement, db);
- const sheet = await useSheetStore().createSheet({
- projectId: issueCreate.projectId,
- name: issueCreate.name + " - " + db.name,
- statement: statement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: {},
+ const project = await projectV1Store.getOrFetchProjectByUID(
+ `${issueCreate.projectId}`
+ );
+ const sheet = await sheetV1Store.createSheet(project.name, {
+ title: issueCreate.name + " - " + db.name,
+ content: new TextEncoder().encode(statement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
});
detail.statement = "";
- detail.sheetId = sheet.id;
+ detail.sheetId = sheetV1Store.getSheetUid(sheet.name);
}
for (const detailItem of context.detailList) {
detailItem.statement = "";
diff --git a/frontend/src/components/Issue/logic/base.ts b/frontend/src/components/Issue/logic/base.ts
index 5060c52a2b..27db87c5e8 100644
--- a/frontend/src/components/Issue/logic/base.ts
+++ b/frontend/src/components/Issue/logic/base.ts
@@ -28,12 +28,18 @@ import {
useDatabaseStore,
useIssueStore,
useProjectV1Store,
- useSheetStore,
- useSheetById,
+ useSheetV1Store,
+ useSheetStatementByUid,
} from "@/store";
import { flattenTaskList, TaskTypeWithStatement } from "./common";
import { maybeCreateBackTraceComments } from "../rollback/common";
import { TenantMode } from "@/types/proto/v1/project_service";
+import { sheetNamePrefix } from "@/store/modules/v1/common";
+import {
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+} from "@/types/proto/v1/sheet_service";
export const useBaseIssueLogic = (params: {
create: Ref<boolean>;
@@ -45,7 +51,7 @@ export const useBaseIssueLogic = (params: {
const issueStore = useIssueStore();
const projectV1Store = useProjectV1Store();
const databaseStore = useDatabaseStore();
- const sheetStore = useSheetStore();
+ const sheetV1Store = useSheetV1Store();
const project = computed(() => {
const projectUID = create.value
@@ -230,13 +236,13 @@ export const useBaseIssueLogic = (params: {
if (create.value) {
const taskCreate = task as TaskCreate;
if (taskCreate.sheetId && taskCreate.sheetId !== UNKNOWN_ID) {
- return useSheetById(taskCreate.sheetId).value?.statement || "";
+ return useSheetStatementByUid(taskCreate.sheetId).value || "";
}
return (task as TaskCreate).statement;
}
return (
- useSheetById(sheetIdOfTask(task as Task) || UNKNOWN_ID).value
- ?.statement || ""
+ useSheetStatementByUid(sheetIdOfTask(task as Task) || UNKNOWN_ID).value ||
+ ""
);
});
@@ -274,26 +280,40 @@ export const useBaseIssueLogic = (params: {
const sheetId = task.sheetId;
const statement = task.statement;
let sheet = undefined;
+
if (sheetId && sheetId !== UNKNOWN_ID) {
- sheet = await sheetStore.getOrFetchSheetById(sheetId);
+ sheet = await sheetV1Store.getOrFetchSheetByName(
+ `${project.value.name}/${sheetNamePrefix}${sheetId}`
+ );
}
for (const taskItem of taskList) {
if (TaskTypeWithStatement.includes(taskItem.type)) {
if (sheet) {
- if (sheet.statement.length < sheet.size) {
+ if (
+ new TextDecoder().decode(sheet.content).length < sheet.contentSize
+ ) {
taskItem.sheetId = sheetId;
} else {
- const newSheet = await sheetStore.createSheet({
- projectId: project.value.uid,
- databaseId: taskItem.databaseId,
- name: uuidv4(),
- statement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: {},
- });
- taskItem.sheetId = newSheet.id;
+ let database = "";
+ if (taskItem.databaseId) {
+ database = (
+ await databaseStore.getOrFetchDatabaseById(taskItem.databaseId)
+ ).name;
+ }
+ const newSheet = await sheetV1Store.createSheet(
+ project.value.name,
+ {
+ title: uuidv4(),
+ content: new TextEncoder().encode(statement),
+ database: database,
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
+ }
+ );
+ taskItem.sheetId = sheetV1Store.getSheetUid(newSheet.name);
}
taskItem.statement = "";
} else {
diff --git a/frontend/src/components/Issue/logic/common.ts b/frontend/src/components/Issue/logic/common.ts
index 71db32567d..a9f10a3122 100644
--- a/frontend/src/components/Issue/logic/common.ts
+++ b/frontend/src/components/Issue/logic/common.ts
@@ -7,7 +7,7 @@ import {
useCurrentUserV1,
useDatabaseStore,
useIssueStore,
- useSheetStore,
+ useSheetV1Store,
useTaskStore,
useUIStateStore,
} from "@/store";
@@ -41,6 +41,15 @@ import {
} from "@/utils";
import { maybeApplyRollbackParams } from "@/plugins/issue/logic/initialize/standard";
import { t } from "@/plugins/i18n";
+import {
+ getSheetPathByLegacyProject,
+ getProjectPathByLegacyProject,
+} from "@/store/modules/v1/common";
+import {
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+} from "@/types/proto/v1/sheet_service";
export const useCommonLogic = () => {
const { create, issue, selectedTask, createIssue, onStatusChanged, dialog } =
@@ -50,7 +59,7 @@ export const useCommonLogic = () => {
const databaseStore = useDatabaseStore();
const issueStore = useIssueStore();
const taskStore = useTaskStore();
- const sheetStore = useSheetStore();
+ const sheetV1Store = useSheetV1Store();
const patchIssue = (
issuePatch: IssuePatch,
@@ -201,17 +210,22 @@ export const useCommonLogic = () => {
if (patchingTaskList.length === 0) return;
// Create a new sheet instead of reusing the old one.
- const sheet = await sheetStore.createSheet({
- projectId: issueEntity.project.id,
- name: uuidv4(),
- statement: newStatement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: getBacktracePayloadWithIssue(issue.value as Issue),
- });
+ const sheet = await sheetV1Store.createSheet(
+ getProjectPathByLegacyProject(issueEntity.project),
+ {
+ title: uuidv4(),
+ content: new TextEncoder().encode(newStatement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: JSON.stringify(
+ getBacktracePayloadWithIssue(issue.value as Issue)
+ ),
+ }
+ );
const patchRequestList = patchingTaskList.map((task) => {
- patchTask(task.id, { sheetId: sheet.id });
+ patchTask(task.id, { sheetId: sheetV1Store.getSheetUid(sheet.name) });
});
await Promise.allSettled(patchRequestList);
}
@@ -247,22 +261,30 @@ export const useCommonLogic = () => {
};
// Create a new sheet to save statement.
if (!taskCreate.sheetId || taskCreate.sheetId === UNKNOWN_ID) {
- const sheet = await sheetStore.createSheet({
- projectId: issueCreate.projectId,
- name: issueCreate.name + " - " + db.name,
- statement: statement,
- visibility: "PROJECT",
- source: "BYTEBASE_ARTIFACT",
- payload: {},
- });
- migrationDetail.sheetId = sheet.id;
- } else {
- const sheetId = taskCreate.sheetId;
- const sheet = await sheetStore.getOrFetchSheetById(sheetId);
- if (sheet.statement.length === sheet.size) {
- await sheetStore.patchSheetById({
- id: sheetId,
- statement: statement,
+ const sheet = await sheetV1Store.createSheet(
+ getProjectPathByLegacyProject(db.project),
+ {
+ title: issueCreate.name + " - " + db.name,
+ content: new TextEncoder().encode(statement),
+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,
+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
+ }
+ );
+ migrationDetail.sheetId = sheetV1Store.getSheetUid(sheet.name);
+ } else if (taskCreate.sheetId !== UNKNOWN_ID) {
+ const sheetName = getSheetPathByLegacyProject(
+ db.project,
+ taskCreate.sheetId
+ );
+ const sheet = await sheetV1Store.getOrFetchSheetByName(sheetName);
+ if (
+ new TextDecoder().decode(sheet?.content).length === sheet?.contentSize
+ ) {
+ await sheetV1Store.patchSheet({
+ name: sheetName,
+ content: new TextEncoder().encode(statement),
});
}
}
diff --git a/frontend/src/components/Issue/rollback/RollbackStatus.vue b/frontend/src/components/Issue/rollback/RollbackStatus.vue
index 65868dafae..2120dbcc09 100644
--- a/frontend/src/components/Issue/rollback/RollbackStatus.vue
+++ b/frontend/src/components/Issue/rollback/RollbackStatus.vue
@@ -81,7 +81,7 @@ import { useRollbackLogic } from "./common";
import IssueStatusIcon from "../IssueStatusIcon.vue";
import LogButton from "./LogButton.vue";
import LoggingButton from "./LoggingButton.vue";
-import { useActivityStore, useIssueById, useSheetStore } from "@/store";
+import { useActivityStore, useIssueById, useSheetV1Store } from "@/store";
import LearnMoreLink from "@/components/LearnMoreLink.vue";
type LocalState = {
@@ -90,7 +90,7 @@ type LocalState = {
};
const router = useRouter();
-const sheetStore = useSheetStore();
+const sheetV1Store = useSheetV1Store();
const context = useIssueLogic();
const { allowRollback } = useRollbackLogic();
@@ -158,12 +158,11 @@ const tryRollbackTask = async () => {
`${issue.value.name}`,
].join(" ");
- const rollbackSheet = await sheetStore.getOrFetchSheetById(
- payload.value!.rollbackSheetId!
- );
+ const sheetUid = payload.value!.rollbackSheetId!;
+ const rollbackSheet = await sheetV1Store.getOrFetchSheetByUid(sheetUid);
const description = [
"The original SQL statement:",
- `${rollbackSheet.statement}`,
+ `${new TextDecoder().decode(rollbackSheet?.content)}`,
].join("\n");
router.push({
@@ -178,7 +177,7 @@ const tryRollbackTask = async () => {
databaseList: [task.value.database!.id].join(","),
rollbackIssueId: issue.value.id,
rollbackTaskIdList: [task.value.id].join(","),
- sheetId: rollbackSheet.id,
+ sheetId: sheetUid,
description,
},
});
diff --git a/frontend/src/components/ProvideSQLEditorContext.vue b/frontend/src/components/ProvideSQLEditorContext.vue
index d6830534a8..9c52d45b2c 100644
--- a/frontend/src/components/ProvideSQLEditorContext.vue
+++ b/frontend/src/components/ProvideSQLEditorContext.vue
@@ -233,7 +233,7 @@ const prepareSheet = async () => {
tabStore.updateCurrentTab({
sheetName,
- name: sheet.name,
+ name: sheet.title,
statement: new TextDecoder().decode(sheet.content),
isSaved: true,
connection: {
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 41035d4090..3c5b0756fe 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -2017,6 +2017,9 @@
"actions": {
"sync-from-vcs": "Sync SQL scripts from VCS"
},
+ "notifications": {
+ "duplicate-success": "Successfully duplicate to \"My sheets\""
+ },
"hint-tips": {
"confirm-to-sync-sheet": "Confirm to sync sheets?",
"confirm-to-delete-this-sheet": "Confirm to delete this sheet?",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 46b79baa84..f8c13a5922 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -2014,6 +2014,9 @@
"actions": {
"sync-from-vcs": "从 VCS 同步 SQL 脚本"
},
+ "notifications": {
+ "duplicate-success": "已成功拷贝至“我的工作表”"
+ },
"hint-tips": {
"confirm-to-sync-sheet": "确定要同步工作表?",
"confirm-to-delete-this-sheet": "确定删除这条工作表?",
diff --git a/frontend/src/store/modules/index.ts b/frontend/src/store/modules/index.ts
index f84d1f415b..5fccb7936f 100644
--- a/frontend/src/store/modules/index.ts
+++ b/frontend/src/store/modules/index.ts
@@ -24,7 +24,6 @@ export * from "./principal";
export * from "./project";
export * from "./repository";
export * from "./router";
-export * from "./sheet";
export * from "./stage";
export * from "./sql";
export * from "./sqlEditor";
diff --git a/frontend/src/store/modules/sheet.ts b/frontend/src/store/modules/sheet.ts
deleted file mode 100644
index 029c073c7c..0000000000
--- a/frontend/src/store/modules/sheet.ts
+++ /dev/null
@@ -1,223 +0,0 @@
-import { defineStore } from "pinia";
-import { computed, unref, watchEffect } from "vue";
-import axios, { type AxiosRequestConfig } from "axios";
-import {
- Sheet,
- SheetId,
- SheetState,
- SheetPatch,
- Principal,
- ResourceObject,
- Database,
- Project,
- unknown,
- UNKNOWN_ID,
- SheetCreate,
- SheetOrganizerUpsert,
- SheetUpsert,
- SheetPayload,
- MaybeRef,
-} from "@/types";
-import { getPrincipalFromIncludedList } from "./principal";
-import { useDatabaseStore } from "./database";
-import { useLegacyProjectStore } from "./project";
-import { getDefaultSheetPayloadWithSource } from "@/utils";
-
-function convertSheetPayload(
- resourceObj: ResourceObject,
- includedList: ResourceObject[]
-) {
- const payload = {};
- try {
- const payloadJSON = resourceObj.attributes.payload;
- if (typeof payloadJSON === "string") {
- Object.assign(payload, JSON.parse(payloadJSON));
- }
- } catch {
- // nothing
- }
-
- return payload;
-}
-
-function convertSheet(
- sheet: ResourceObject,
- includedList: ResourceObject[]
-): Sheet {
- let project = unknown("PROJECT") as Project;
- let database = unknown("DATABASE") as Database;
-
- const projectId = sheet.attributes.projectId;
- const databaseId = sheet.attributes.databaseId || UNKNOWN_ID;
-
- const databaseStore = useDatabaseStore();
- const projectStore = useLegacyProjectStore();
- for (const item of includedList || []) {
- if (item.type == "project" && Number(item.id) === Number(projectId)) {
- project = projectStore.convert(item, includedList);
- }
- if (item.type == "database" && Number(item.id) == Number(databaseId)) {
- database = databaseStore.convert(item, includedList);
- }
- }
-
- const payload = convertSheetPayload(sheet, includedList);
-
- return {
- ...(sheet.attributes as Omit<Sheet, "id" | "creator" | "updater">),
- id: parseInt(sheet.id),
- creator: getPrincipalFromIncludedList(
- sheet.relationships!.creator.data,
- includedList
- ) as Principal,
- updater: getPrincipalFromIncludedList(
- sheet.relationships!.updater.data,
- includedList
- ) as Principal,
- project,
- database,
- payload: payload as SheetPayload,
- };
-}
-
-export const useSheetStore = defineStore("sheet", {
- state: (): SheetState => ({
- sheetList: [],
- sheetById: new Map(),
- }),
-
- actions: {
- getSheetById(sheetId: SheetId) {
- const sheet = this.sheetById.get(sheetId);
- return sheet ?? unknown("SHEET");
- },
- setSheetList(payload: Sheet[]) {
- this.sheetList = payload;
- },
- setSheetById({ sheetId, sheet }: { sheetId: SheetId; sheet: Sheet }) {
- const item = this.sheetList.find((sheet) => sheet.id === sheetId);
- if (item !== undefined) {
- Object.assign(item, sheet);
- }
- this.sheetById.set(sheetId, sheet);
- },
- upsertSheet(sheetUpsert: SheetUpsert): Promise<Sheet> {
- if (sheetUpsert.id) {
- return this.patchSheetById({
- id: sheetUpsert.id,
- name: sheetUpsert.name,
- statement: sheetUpsert.statement,
- payload: sheetUpsert.payload,
- });
- }
-
- return this.createSheet({
- payload: getDefaultSheetPayloadWithSource("BYTEBASE"),
- ...sheetUpsert,
- visibility: "PRIVATE",
- source: "BYTEBASE",
- });
- },
- async createSheet(
- sheetCreate: SheetCreate,
- config?: AxiosRequestConfig
- ): Promise<Sheet> {
- if (sheetCreate.databaseId === UNKNOWN_ID) {
- sheetCreate.databaseId = undefined;
- }
-
- const attributes: Record<string, any> = { ...sheetCreate };
- if (typeof attributes.payload === "object") {
- attributes.payload = JSON.stringify(attributes.payload);
- }
-
- const resData = (
- await axios.post(
- `/api/sheet`,
- {
- data: {
- type: "createSheet",
- attributes,
- },
- },
- config
- )
- ).data;
- const sheet = convertSheet(resData.data, resData.included);
-
- this.setSheetList(
- this.sheetList.concat(sheet).sort((a, b) => b.createdTs - a.createdTs)
- );
- this.setSheetById({
- sheetId: sheet.id,
- sheet: sheet,
- });
-
- return sheet;
- },
- async fetchSheetById(sheetId: SheetId) {
- try {
- const data = (await axios.get(`/api/sheet/${sheetId}`)).data;
- const sheet = convertSheet(data.data, data.included);
- this.setSheetById({
- sheetId: sheet.id,
- sheet: sheet,
- });
-
- return sheet;
- } catch {
- return unknown("SHEET");
- }
- },
- async getOrFetchSheetById(sheetId: SheetId) {
- const storedSheet = this.sheetById.get(sheetId);
- if (storedSheet && storedSheet.id !== UNKNOWN_ID) {
- return storedSheet;
- }
- return this.fetchSheetById(sheetId);
- },
- async patchSheetById(sheetPatch: SheetPatch): Promise<Sheet> {
- const attributes: Record<string, any> = { ...sheetPatch };
- if (typeof attributes.payload === "object") {
- attributes.payload = JSON.stringify(attributes.payload);
- }
-
- const resData = (
- await axios.patch(`/api/sheet/${sheetPatch.id}`, {
- data: {
- type: "sheetPatch",
- attributes,
- },
- })
- ).data;
-
- const sheet = convertSheet(resData.data, resData.included);
-
- this.setSheetById({
- sheetId: sheet.id,
- sheet: sheet,
- });
-
- return sheet;
- },
- async upsertSheetOrganizer(sheetOrganizerUpsert: SheetOrganizerUpsert) {
- await axios.patch(`/api/sheet/${sheetOrganizerUpsert.sheeId}/organizer`, {
- data: {
- type: "sheetOrganizerUpsert",
- attributes: sheetOrganizerUpsert,
- },
- });
- },
- },
-});
-
-export const useSheetById = (sheetId: MaybeRef<SheetId>) => {
- const store = useSheetStore();
- watchEffect(async () => {
- await store.getOrFetchSheetById(unref(sheetId));
- });
-
- return computed(() => {
- return store.getSheetById(unref(sheetId));
- });
-};
diff --git a/frontend/src/store/modules/v1/common.ts b/frontend/src/store/modules/v1/common.ts
index 25a52181f2..bf05ffd163 100644
--- a/frontend/src/store/modules/v1/common.ts
+++ b/frontend/src/store/modules/v1/common.ts
@@ -97,9 +97,18 @@ export const getDatabasePathByLegacyDatabase = (database: Database): string => {
)}/${databaseNamePrefix}${database.name}`;
};
+export const getProjectPathByLegacyProject = (project: Project): string => {
+ return `${projectNamePrefix}${project.resourceId}`;
+};
+
export const getSheetPathByLegacyProject = (
project: Project,
sheetId: SheetId
): string => {
- return `${projectNamePrefix}${project.resourceId}/${sheetNamePrefix}${sheetId}`;
+ if (sheetId === UNKNOWN_ID) {
+ return "";
+ }
+ return `${getProjectPathByLegacyProject(
+ project
+ )}/${sheetNamePrefix}${sheetId}`;
};
diff --git a/frontend/src/store/modules/v1/sheet.ts b/frontend/src/store/modules/v1/sheet.ts
index 098f3db8c8..26e15f366a 100644
--- a/frontend/src/store/modules/v1/sheet.ts
+++ b/frontend/src/store/modules/v1/sheet.ts
@@ -1,11 +1,18 @@
import { defineStore } from "pinia";
+import { computed, unref, watchEffect } from "vue";
import { sheetServiceClient } from "@/grpcweb";
import { isEqual, isUndefined, isEmpty } from "lodash-es";
-import { Sheet } from "@/types/proto/v1/sheet_service";
+import { Sheet, SheetOrganizer } from "@/types/proto/v1/sheet_service";
import { useTabStore } from "../tab";
import { useCurrentUserV1 } from "../auth";
-import { getUserEmailFromIdentifier, projectNamePrefix } from "./common";
+import {
+ getUserEmailFromIdentifier,
+ projectNamePrefix,
+ sheetNamePrefix,
+ getProjectAndSheetId,
+} from "./common";
import { isSheetReadableV1 } from "@/utils";
+import { UNKNOWN_ID, SheetId, MaybeRef } from "@/types";
interface SheetState {
sheetByName: Map<string, Sheet>;
@@ -67,6 +74,21 @@ export const useSheetV1Store = defineStore("sheet_v1", {
},
actions: {
+ getSheetUid(name: string): number {
+ const [_, sheetId] = getProjectAndSheetId(name);
+ if (!sheetId || Number.isNaN(sheetId)) {
+ return UNKNOWN_ID;
+ }
+ return Number(sheetId);
+ },
+ getProjectResourceId(name: string): string {
+ const [projectId, _] = getProjectAndSheetId(name);
+ return projectId;
+ },
+ getSheetParentPath(name: string): string {
+ const projectId = this.getProjectResourceId(name);
+ return `${projectNamePrefix}${projectId}`;
+ },
setSheetList(sheets: Sheet[]) {
for (const sheet of sheets) {
this.sheetByName.set(sheet.name, sheet);
@@ -89,8 +111,12 @@ export const useSheetV1Store = defineStore("sheet_v1", {
return;
}
+ const updateMask = getUpdateMaskForSheet(exist, sheet);
+ if (updateMask.length === 0) {
+ return exist;
+ }
const updatedSheet = await this.patchSheetWithUpdateMask(
- getUpdateMaskForSheet(exist, sheet),
+ updateMask,
sheet
);
this.sheetByName.set(updatedSheet.name, updatedSheet);
@@ -122,6 +148,29 @@ export const useSheetV1Store = defineStore("sheet_v1", {
const sheet = this.sheetByName.get(name);
return sheet;
},
+ getSheetByUid(uid: SheetId) {
+ for (const [name, sheet] of this.sheetByName) {
+ if (`${this.getSheetUid(name)}` === `${uid}`) {
+ return sheet;
+ }
+ }
+ },
+ async getOrFetchSheetByUid(uid: SheetId) {
+ const sheet = this.getSheetByUid(uid);
+ if (sheet) {
+ return sheet;
+ }
+
+ try {
+ const sheet = await sheetServiceClient.getSheet({
+ name: `${projectNamePrefix}-/${sheetNamePrefix}${uid}`,
+ });
+ this.sheetByName.set(sheet.name, sheet);
+ return sheet;
+ } catch {
+ return;
+ }
+ },
async getOrFetchSheetByName(name: string) {
const storedSheet = this.sheetByName.get(name);
if (storedSheet) {
@@ -164,6 +213,13 @@ export const useSheetV1Store = defineStore("sheet_v1", {
parent: project,
});
},
+ async upsertSheetOrganizer(organizer: Partial<SheetOrganizer>) {
+ await sheetServiceClient.updateSheetOrganizer({
+ organizer,
+ // for now we only support change the `starred` field.
+ updateMask: ["starred"],
+ });
+ },
},
});
@@ -201,3 +257,16 @@ const getUpdateMaskForSheet = (
}
return updateMask;
};
+
+export const useSheetStatementByUid = (sheetId: MaybeRef<SheetId>) => {
+ const store = useSheetV1Store();
+ watchEffect(async () => {
+ await store.getOrFetchSheetByUid(unref(sheetId));
+ });
+
+ return computed(() => {
+ return new TextDecoder().decode(
+ store.getSheetByUid(unref(sheetId))?.content
+ );
+ });
+};
diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts
index 5c385347ca..205c05f2f8 100644
--- a/frontend/src/types/index.ts
+++ b/frontend/src/types/index.ts
@@ -39,7 +39,6 @@ export * from "./webTerminal";
export * from "./tab";
export * from "./subscription";
export * from "./sheet";
-export * from "./sheetOrganizer";
export * from "./sqlReview";
export * from "./utils";
export * from "./onboardingGuide";
diff --git a/frontend/src/types/proto/v1/sheet_service.ts b/frontend/src/types/proto/v1/sheet_service.ts
index 61e2d375d5..5314bcc8d2 100644
--- a/frontend/src/types/proto/v1/sheet_service.ts
+++ b/frontend/src/types/proto/v1/sheet_service.ts
@@ -49,6 +49,36 @@ export interface UpdateSheetRequest {
updateMask?: string[];
}
+export interface UpdateSheetOrganizerRequest {
+ /**
+ * The organizer to update.
+ *
+ * The organizer's `sheet` field is used to identify the sheet.
+ * Format: projects/{project}/sheets/{sheet}
+ */
+ organizer?: SheetOrganizer;
+ /**
+ * The list of fields to be updated.
+ * Fields are specified relative to the sheet organizer.
+ * Only support update the following fields for now:
+ * - `starred`
+ * - `pinned`
+ */
+ updateMask?: string[];
+}
+
+export interface SheetOrganizer {
+ /**
+ * The name of the sheet.
+ * Format: projects/{project}/sheets/{sheet}
+ */
+ sheet: string;
+ /** starred means if the sheet is starred. */
+ starred: boolean;
+ /** pinned means if the sheet is pinned. */
+ pinned: boolean;
+}
+
export interface DeleteSheetRequest {
/**
* The name of the sheet to delete.
@@ -506,6 +536,164 @@ export const UpdateSheetRequest = {
},
};
+function createBaseUpdateSheetOrganizerRequest(): UpdateSheetOrganizerRequest {
+ return { organizer: undefined, updateMask: undefined };
+}
+
+export const UpdateSheetOrganizerRequest = {
+ encode(message: UpdateSheetOrganizerRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.organizer !== undefined) {
+ SheetOrganizer.encode(message.organizer, writer.uint32(10).fork()).ldelim();
+ }
+ if (message.updateMask !== undefined) {
+ FieldMask.encode(FieldMask.wrap(message.updateMask), writer.uint32(18).fork()).ldelim();
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): UpdateSheetOrganizerRequest {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseUpdateSheetOrganizerRequest();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.organizer = SheetOrganizer.decode(reader, reader.uint32());
+ continue;
+ case 2:
+ if (tag !== 18) {
+ break;
+ }
+
+ message.updateMask = FieldMask.unwrap(FieldMask.decode(reader, reader.uint32()));
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): UpdateSheetOrganizerRequest {
+ return {
+ organizer: isSet(object.organizer) ? SheetOrganizer.fromJSON(object.organizer) : undefined,
+ updateMask: isSet(object.updateMask) ? FieldMask.unwrap(FieldMask.fromJSON(object.updateMask)) : undefined,
+ };
+ },
+
+ toJSON(message: UpdateSheetOrganizerRequest): unknown {
+ const obj: any = {};
+ message.organizer !== undefined &&
+ (obj.organizer = message.organizer ? SheetOrganizer.toJSON(message.organizer) : undefined);
+ message.updateMask !== undefined && (obj.updateMask = FieldMask.toJSON(FieldMask.wrap(message.updateMask)));
+ return obj;
+ },
+
+ create(base?: DeepPartial<UpdateSheetOrganizerRequest>): UpdateSheetOrganizerRequest {
+ return UpdateSheetOrganizerRequest.fromPartial(base ?? {});
+ },
+
+ fromPartial(object: DeepPartial<UpdateSheetOrganizerRequest>): UpdateSheetOrganizerRequest {
+ const message = createBaseUpdateSheetOrganizerRequest();
+ message.organizer = (object.organizer !== undefined && object.organizer !== null)
+ ? SheetOrganizer.fromPartial(object.organizer)
+ : undefined;
+ message.updateMask = object.updateMask ?? undefined;
+ return message;
+ },
+};
+
+function createBaseSheetOrganizer(): SheetOrganizer {
+ return { sheet: "", starred: false, pinned: false };
+}
+
+export const SheetOrganizer = {
+ encode(message: SheetOrganizer, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
+ if (message.sheet !== "") {
+ writer.uint32(10).string(message.sheet);
+ }
+ if (message.starred === true) {
+ writer.uint32(16).bool(message.starred);
+ }
+ if (message.pinned === true) {
+ writer.uint32(24).bool(message.pinned);
+ }
+ return writer;
+ },
+
+ decode(input: _m0.Reader | Uint8Array, length?: number): SheetOrganizer {
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
+ let end = length === undefined ? reader.len : reader.pos + length;
+ const message = createBaseSheetOrganizer();
+ while (reader.pos < end) {
+ const tag = reader.uint32();
+ switch (tag >>> 3) {
+ case 1:
+ if (tag !== 10) {
+ break;
+ }
+
+ message.sheet = reader.string();
+ continue;
+ case 2:
+ if (tag !== 16) {
+ break;
+ }
+
+ message.starred = reader.bool();
+ continue;
+ case 3:
+ if (tag !== 24) {
+ break;
+ }
+
+ message.pinned = reader.bool();
+ continue;
+ }
+ if ((tag & 7) === 4 || tag === 0) {
+ break;
+ }
+ reader.skipType(tag & 7);
+ }
+ return message;
+ },
+
+ fromJSON(object: any): SheetOrganizer {
+ return {
+ sheet: isSet(object.sheet) ? String(object.sheet) : "",
+ starred: isSet(object.starred) ? Boolean(object.starred) : false,
+ pinned: isSet(object.pinned) ? Boolean(object.pinned) : false,
+ };
+ },
+
+ toJSON(message: SheetOrganizer): unknown {
+ const obj: any = {};
+ message.sheet !== undefined && (obj.sheet = message.sheet);
+ message.starred !== undefined && (obj.starred = message.starred);
+ message.pinned !== undefined && (obj.pinned = message.pinned);
+ return obj;
+ },
+
+ create(base?: DeepPartial<SheetOrganizer>): SheetOrganizer {
+ return SheetOrganizer.fromPartial(base ?? {});
+ },
+
+ fromPartial(object: DeepPartial<SheetOrganizer>): SheetOrganizer {
+ const message = createBaseSheetOrganizer();
+ message.sheet = object.sheet ?? "";
+ message.starred = object.starred ?? false;
+ message.pinned = object.pinned ?? false;
+ return message;
+ },
+};
+
function createBaseDeleteSheetRequest(): DeleteSheetRequest {
return { name: "" };
}
@@ -1246,6 +1434,112 @@ export const SheetServiceDefinition = {
},
},
},
+ updateSheetOrganizer: {
+ name: "UpdateSheetOrganizer",
+ requestType: UpdateSheetOrganizerRequest,
+ requestStream: false,
+ responseType: SheetOrganizer,
+ responseStream: false,
+ options: {
+ _unknownFields: {
+ 8410: [
+ new Uint8Array([
+ 21,
+ 111,
+ 114,
+ 103,
+ 97,
+ 110,
+ 105,
+ 122,
+ 101,
+ 114,
+ 44,
+ 117,
+ 112,
+ 100,
+ 97,
+ 116,
+ 101,
+ 95,
+ 109,
+ 97,
+ 115,
+ 107,
+ ]),
+ ],
+ 578365826: [
+ new Uint8Array([
+ 64,
+ 58,
+ 9,
+ 111,
+ 114,
+ 103,
+ 97,
+ 110,
+ 105,
+ 122,
+ 101,
+ 114,
+ 26,
+ 51,
+ 47,
+ 118,
+ 49,
+ 47,
+ 123,
+ 111,
+ 114,
+ 103,
+ 97,
+ 110,
+ 105,
+ 122,
+ 101,
+ 114,
+ 46,
+ 115,
+ 104,
+ 101,
+ 101,
+ 116,
+ 61,
+ 112,
+ 114,
+ 111,
+ 106,
+ 101,
+ 99,
+ 116,
+ 115,
+ 47,
+ 42,
+ 47,
+ 115,
+ 104,
+ 101,
+ 101,
+ 116,
+ 115,
+ 47,
+ 42,
+ 125,
+ 47,
+ 111,
+ 114,
+ 103,
+ 97,
+ 110,
+ 105,
+ 122,
+ 101,
+ 114,
+ ]),
+ ],
+ },
+ },
+ },
deleteSheet: {
name: "DeleteSheet",
requestType: DeleteSheetRequest,
@@ -1360,6 +1654,10 @@ export interface SheetServiceImplementation<CallContextExt = {}> {
context: CallContext & CallContextExt,
): Promise<DeepPartial<SearchSheetsResponse>>;
updateSheet(request: UpdateSheetRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Sheet>>;
+ updateSheetOrganizer(
+ request: UpdateSheetOrganizerRequest,
+ context: CallContext & CallContextExt,
+ ): Promise<DeepPartial<SheetOrganizer>>;
deleteSheet(request: DeleteSheetRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Empty>>;
syncSheets(request: SyncSheetsRequest, context: CallContext & CallContextExt): Promise<DeepPartial<Empty>>;
}
@@ -1372,6 +1670,10 @@ export interface SheetServiceClient<CallOptionsExt = {}> {
options?: CallOptions & CallOptionsExt,
): Promise<SearchSheetsResponse>;
updateSheet(request: DeepPartial<UpdateSheetRequest>, options?: CallOptions & CallOptionsExt): Promise<Sheet>;
+ updateSheetOrganizer(
+ request: DeepPartial<UpdateSheetOrganizerRequest>,
+ options?: CallOptions & CallOptionsExt,
+ ): Promise<SheetOrganizer>;
deleteSheet(request: DeepPartial<DeleteSheetRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
syncSheets(request: DeepPartial<SyncSheetsRequest>, options?: CallOptions & CallOptionsExt): Promise<Empty>;
}
diff --git a/frontend/src/types/sheet.ts b/frontend/src/types/sheet.ts
index b02e479d2e..c779a11583 100644
--- a/frontend/src/types/sheet.ts
+++ b/frontend/src/types/sheet.ts
@@ -1,27 +1,6 @@
-import {
- SheetId,
- Database,
- DatabaseId,
- Principal,
- Project,
- ProjectId,
- RowStatus,
- PrincipalId,
- IssueId,
-} from ".";
+import { IssueId } from ".";
import { Sheet_Visibility } from "@/types/proto/v1/sheet_service";
-export type SheetVisibility = "PRIVATE" | "PROJECT" | "PUBLIC";
-
-export type SheetSource =
- | "BYTEBASE"
- | "GITLAB"
- | "GITHUB"
- | "BITBUCKET"
- | "BYTEBASE_ARTIFACT";
-
-export type SheetType = "SQL";
-
interface SheetVCSPayload {
fileName: string;
filePath: string;
@@ -49,66 +28,6 @@ export type SheetPayload =
| SheetIssueBacktracePayload
| SheetEmptyPayload;
-export interface Sheet {
- id: SheetId;
-
- // Standard fields
- rowStatus: RowStatus;
- creator: Principal;
- creatorId: PrincipalId;
- createdTs: number;
- updater: Principal;
- updatedTs: number;
-
- // Related fields
- projectId: ProjectId;
- project: Project;
- databaseId?: DatabaseId;
- database?: Database;
-
- // Domain fields
- name: string;
- statement: string;
- visibility: SheetVisibility;
- source: SheetSource;
- type: SheetType;
- starred: boolean;
- pinned: boolean;
- payload: SheetPayload;
-
- // The current size of statement in bytes.
- size: number;
-}
-
-export interface SheetUpsert {
- id?: SheetId;
- projectId: ProjectId;
- databaseId?: DatabaseId;
- name: string;
- statement: string;
- visibility?: SheetVisibility;
- payload?: SheetPayload;
-}
-
-export interface SheetCreate {
- projectId: ProjectId;
- databaseId?: DatabaseId;
- name: string;
- statement: string;
- visibility: SheetVisibility;
- payload: SheetPayload;
- source: SheetSource;
-}
-
-export interface SheetPatch {
- id: SheetId;
- name?: string;
- statement?: string;
- visibility?: SheetVisibility;
- rowStatus?: RowStatus;
- payload?: SheetPayload;
-}
-
export type AccessOption = {
label: string;
description: string;
diff --git a/frontend/src/types/sheetOrganizer.ts b/frontend/src/types/sheetOrganizer.ts
deleted file mode 100644
index c12ec84859..0000000000
--- a/frontend/src/types/sheetOrganizer.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { SheetId } from ".";
-
-export type SheetOrganizerUpsert = {
- sheeId: SheetId;
- starred?: boolean;
- pinned?: boolean;
-};
diff --git a/frontend/src/types/store.ts b/frontend/src/types/store.ts
index 3cf57c6485..75774f4579 100644
--- a/frontend/src/types/store.ts
+++ b/frontend/src/types/store.ts
@@ -159,7 +159,6 @@ export interface SQLEditorState {
}
export interface SheetState {
- sheetList: Sheet[];
sheetById: Map<SheetId, Sheet>;
}
diff --git a/frontend/src/utils/sheet.ts b/frontend/src/utils/sheet.ts
index a100e009d6..0652a57e30 100644
--- a/frontend/src/utils/sheet.ts
+++ b/frontend/src/utils/sheet.ts
@@ -1,35 +1,20 @@
-import { isUndefined, uniq } from "lodash-es";
+import { uniq } from "lodash-es";
-import { useSheetStore } from "@/store";
+import { useSheetV1Store } from "@/store";
import {
Issue,
- Sheet,
SheetId,
SheetIssueBacktracePayload,
- SheetPayload,
- SheetSource,
Task,
TaskDatabaseCreatePayload,
TaskDatabaseDataUpdatePayload,
TaskDatabaseSchemaUpdateGhostSyncPayload,
TaskDatabaseSchemaUpdatePayload,
TaskDatabaseSchemaUpdateSDLPayload,
+ UNKNOWN_ID,
} from "@/types";
import { flattenTaskList } from "@/components/Issue/logic";
-
-// getDefaultSheetPayloadWithSource gets the default payload with sheet source.
-export const getDefaultSheetPayloadWithSource = (
- sheetSource: SheetSource
-): SheetPayload => {
- if (sheetSource === "BYTEBASE") {
- // As we don't save any data for sheet from UI, return an empty payload.
- return {};
- }
-
- // Shouldn't reach this line.
- // For those sheet from VCS, we create and patch them in backend.
- return {};
-};
+import { getSheetPathByLegacyProject } from "@/store/modules/v1/common";
export const sheetIdOfTask = (task: Task) => {
switch (task.type) {
@@ -74,21 +59,22 @@ export const maybeSetSheetBacktracePayloadByIssue = async (issue: Issue) => {
flattenTaskList(issue).forEach((task) => {
const sheetId = sheetIdOfTask(task as Task);
- if (sheetId) {
+ if (sheetId && sheetId !== UNKNOWN_ID) {
sheetIdList.push(sheetId);
}
});
- const store = useSheetStore();
+ const sheetV1Store = useSheetV1Store();
const requests = uniq(sheetIdList).map((sheetId) => {
const payload: SheetIssueBacktracePayload = {
type: "bb.sheet.issue-backtrace",
issueId: issue.id,
issueName: issue.name,
};
- return store.patchSheetById({
- id: sheetId,
- payload,
+
+ return sheetV1Store.patchSheet({
+ name: getSheetPathByLegacyProject(issue.project, sheetId),
+ payload: JSON.stringify(payload),
});
});
@@ -106,16 +92,3 @@ export const getBacktracePayloadWithIssue = (issue: Issue) => {
issueName: issue.name,
};
};
-
-export const getSheetIssueBacktracePayload = (sheet: Sheet) => {
- const maybePayload = (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/views/sql-editor/EditorCommon/SaveSheetForm.vue b/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vue
index dd2bbe6af4..2488f6f9df 100644
--- a/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/SaveSheetForm.vue
@@ -2,7 +2,7 @@
<div class="save-sheet-modal w-80">
<n-input
ref="sheetNameInputRef"
- v-model:value="sheetName"
+ v-model:value="sheetTitle"
:placeholder="$t('sql-editor.save-sheet-input-placeholder')"
@keyup.enter="handleSaveSheet"
/>
@@ -27,11 +27,11 @@ const emit = defineEmits<{
const tabStore = useTabStore();
-const sheetName = ref(tabStore.currentTab.name);
+const sheetTitle = ref(tabStore.currentTab.name);
const sheetNameInputRef = ref();
const handleSaveSheet = () => {
- emit("save-sheet", sheetName.value);
+ emit("save-sheet", sheetTitle.value);
};
nextTick(() => {
diff --git a/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue b/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue
index 6fc0aa88af..a482ed2d58 100644
--- a/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue
+++ b/frontend/src/views/sql-editor/EditorCommon/SaveSheetModal.vue
@@ -11,15 +11,20 @@
<script lang="ts" setup>
import { computed, reactive } from "vue";
-import type { SheetUpsert } from "@/types";
import { UNKNOWN_ID } from "@/types";
-import { useDatabaseStore, useSheetStore, useTabStore } from "@/store";
+import { useDatabaseStore, useSheetV1Store, useTabStore } from "@/store";
import {
- getProjectAndSheetId,
- getSheetPathByLegacyProject,
+ getDatabasePathByLegacyDatabase,
+ getProjectPathByLegacyProject,
} from "@/store/modules/v1/common";
import { defaultTabName, getDefaultTabNameFromConnection } from "@/utils";
import SaveSheetForm from "./SaveSheetForm.vue";
+import {
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+ Sheet,
+} from "@/types/proto/v1/sheet_service";
type LocalState = {
showModal: boolean;
@@ -27,7 +32,7 @@ type LocalState = {
const tabStore = useTabStore();
const databaseStore = useDatabaseStore();
-const sheetStore = useSheetStore();
+const sheetV1Store = useSheetV1Store();
const state = reactive<LocalState>({
showModal: false,
@@ -53,24 +58,41 @@ const doSaveSheet = async (sheetTitle?: string) => {
const { name, statement, sheetName } = tabStore.currentTab;
sheetTitle = sheetTitle || name;
- const sheetId = getProjectAndSheetId(sheetName ?? "")[1];
+ const sheetId = sheetV1Store.getSheetUid(sheetName ?? "");
const conn = tabStore.currentTab.connection;
const database = await databaseStore.getOrFetchDatabaseById(conn.databaseId);
- const sheetUpsert: SheetUpsert = {
- id: sheetId,
- projectId: database.project.id,
- databaseId: conn.databaseId,
- name: sheetTitle,
- statement: statement,
- };
- const sheet = await sheetStore.upsertSheet(sheetUpsert);
-
- tabStore.updateCurrentTab({
- sheetName: getSheetPathByLegacyProject(sheet.project, sheet.id),
- isSaved: true,
- name: sheetTitle,
- });
+
+ let sheet: Sheet | undefined;
+ if (sheetId !== UNKNOWN_ID) {
+ sheet = await sheetV1Store.patchSheet({
+ name: sheetName,
+ database: getDatabasePathByLegacyDatabase(database),
+ title: sheetTitle,
+ content: new TextEncoder().encode(statement),
+ });
+ } else {
+ sheet = await sheetV1Store.createSheet(
+ getProjectPathByLegacyProject(database.project),
+ {
+ title: sheetTitle,
+ content: new TextEncoder().encode(statement),
+ database: getDatabasePathByLegacyDatabase(database),
+ visibility: Sheet_Visibility.VISIBILITY_PRIVATE,
+ source: Sheet_Source.SOURCE_BYTEBASE,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
+ }
+ );
+ }
+
+ if (sheet) {
+ tabStore.updateCurrentTab({
+ sheetName: sheet.name,
+ isSaved: true,
+ name: sheetTitle,
+ });
+ }
};
const needSheetName = (sheetName: string | undefined) => {
@@ -92,18 +114,18 @@ const needSheetName = (sheetName: string | undefined) => {
return false;
};
-const trySaveSheet = (sheetName?: string) => {
+const trySaveSheet = (sheetTitle?: string) => {
if (!allowSave.value) {
return;
}
- if (needSheetName(sheetName)) {
+ if (needSheetName(sheetTitle)) {
state.showModal = true;
return;
}
state.showModal = false;
- doSaveSheet(sheetName);
+ doSaveSheet(sheetTitle);
};
const close = () => {
diff --git a/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue b/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue
index 192b482b3c..b2abc4f9be 100644
--- a/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue
+++ b/frontend/src/views/sql-editor/Sheet/SheetTable/Dropdown.vue
@@ -17,14 +17,14 @@ import { useI18n } from "vue-i18n";
import { type DropdownOption, NDropdown, useDialog } from "naive-ui";
import { Sheet } from "@/types/proto/v1/sheet_service";
-import type { SheetCreate, SheetOrganizerUpsert } from "@/types";
import type { SheetViewMode } from "../types";
-import { getDefaultSheetPayloadWithSource, isSheetWritableV1 } from "@/utils";
-import { useSheetStore, useSheetV1Store, useProjectV1Store } from "@/store";
+import { isSheetWritableV1 } from "@/utils";
+import { useSheetV1Store, pushNotification } from "@/store";
import {
- getProjectAndSheetId,
- getInstanceAndDatabaseId,
-} from "@/store/modules/v1/common";
+ Sheet_Visibility,
+ Sheet_Source,
+ Sheet_Type,
+} from "@/types/proto/v1/sheet_service";
const props = defineProps<{
view: SheetViewMode;
@@ -36,7 +36,7 @@ const emit = defineEmits<{
}>();
const { t } = useI18n();
-const sheetStore = useSheetStore();
+const sheetV1Store = useSheetV1Store();
const dialog = useDialog();
const options = computed(() => {
@@ -91,7 +91,7 @@ const handleAction = async (key: string) => {
maskClosable: false,
closeOnEsc: false,
async onPositiveClick() {
- await useSheetV1Store().deleteSheetByName(sheet.name);
+ await sheetV1Store.deleteSheetByName(sheet.name);
emit("refresh");
dialogInstance.destroy();
},
@@ -103,18 +103,10 @@ const handleAction = async (key: string) => {
showIcon: true,
});
} else if (key === "star" || key === "unstar") {
- const [_, uid] = getProjectAndSheetId(sheet.name);
- const sheetOrganizerUpsert: SheetOrganizerUpsert = {
- sheeId: uid,
- };
-
- if (key === "star") {
- sheetOrganizerUpsert.starred = true;
- } else if (key === "unstar") {
- sheetOrganizerUpsert.starred = false;
- }
-
- await sheetStore.upsertSheetOrganizer(sheetOrganizerUpsert);
+ await sheetV1Store.upsertSheetOrganizer({
+ sheet: sheet.name,
+ starred: key === "star",
+ });
emit("refresh");
} else if (key === "duplicate") {
const dialogInstance = dialog.create({
@@ -125,24 +117,23 @@ const handleAction = async (key: string) => {
maskClosable: false,
closeOnEsc: false,
async onPositiveClick() {
- const [projectId, _] = getProjectAndSheetId(sheet.name);
- const projectV1 = useProjectV1Store().getProjectByName(
- `projects/${projectId}`
+ await sheetV1Store.createSheet(
+ sheetV1Store.getSheetParentPath(sheet.name),
+ {
+ title: sheet.title,
+ content: sheet.content,
+ database: sheet.database,
+ visibility: Sheet_Visibility.VISIBILITY_PRIVATE,
+ source: Sheet_Source.SOURCE_BYTEBASE,
+ type: Sheet_Type.TYPE_SQL,
+ payload: "{}",
+ }
);
-
- const sheetCreate: SheetCreate = {
- projectId: projectV1.uid,
- name: sheet.title,
- statement: new TextDecoder().decode(sheet.content),
- visibility: "PRIVATE",
- payload: getDefaultSheetPayloadWithSource("BYTEBASE"),
- source: "BYTEBASE",
- };
- if (sheet.database) {
- sheetCreate.databaseId = getInstanceAndDatabaseId(sheet.database)[1];
- }
- await sheetStore.createSheet(sheetCreate);
- emit("refresh");
+ pushNotification({
+ module: "bytebase",
+ style: "INFO",
+ title: t("sheet.notifications.duplicate-success"),
+ });
dialogInstance.destroy();
},
onNegativeClick() {
diff --git a/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue b/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue
index a682dfb3b5..1a6f158201 100644
--- a/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue
+++ b/frontend/src/views/sql-editor/Sheet/SheetTable/SheetTable.vue
@@ -49,12 +49,12 @@ import { useI18n } from "vue-i18n";
import dayjs from "dayjs";
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 { sheetSlugV1 } from "@/utils";
-import { useUserStore } from "@/store";
+import { useUserStore, useSheetV1Store } from "@/store";
+import { Sheet_Visibility } from "@/types/proto/v1/sheet_service";
const props = withDefaults(
defineProps<{
@@ -74,6 +74,7 @@ defineEmits<{
const { t } = useI18n();
const router = useRouter();
+const sheetV1Store = useSheetV1Store();
const showCreator = computed(() => {
return props.view === "shared" || props.view === "starred";
@@ -120,7 +121,15 @@ const headers = computed(() => {
});
const getValueList = (sheet: Sheet) => {
- const [projName, _] = getProjectAndSheetId(sheet.name);
+ const projName = sheetV1Store.getProjectResourceId(sheet.name);
+ let visibility = t("sql-editor.private");
+ switch (sheet.visibility) {
+ case Sheet_Visibility.VISIBILITY_PROJECT:
+ visibility = t("common.project");
+ break;
+ case Sheet_Visibility.VISIBILITY_PUBLIC:
+ visibility = t("sql-editor.public");
+ }
const valueList = [
{
key: "name",
@@ -132,7 +141,7 @@ const getValueList = (sheet: Sheet) => {
},
{
key: "visibility",
- value: sheet.visibility,
+ value: visibility,
},
];
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 25a46055ff..48e6e8c288 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -441,7 +441,9 @@
- [SearchSheetsRequest](#bytebase-v1-SearchSheetsRequest)
- [SearchSheetsResponse](#bytebase-v1-SearchSheetsResponse)
- [Sheet](#bytebase-v1-Sheet)
+ - [SheetOrganizer](#bytebase-v1-SheetOrganizer)
- [SyncSheetsRequest](#bytebase-v1-SyncSheetsRequest)
+ - [UpdateSheetOrganizerRequest](#bytebase-v1-UpdateSheetOrganizerRequest)
- [UpdateSheetRequest](#bytebase-v1-UpdateSheetRequest)
- [Sheet.Source](#bytebase-v1-Sheet-Source)
@@ -6916,6 +6918,23 @@ When paginating, all other parameters provided to `SearchSheets` must match the
+<a name="bytebase-v1-SheetOrganizer"></a>
+
+### SheetOrganizer
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| sheet | [string](#string) | | The name of the sheet. Format: projects/{project}/sheets/{sheet} |
+| starred | [bool](#bool) | | starred means if the sheet is starred. |
+| pinned | [bool](#bool) | | pinned means if the sheet is pinned. |
+
+
+
+
+
+
<a name="bytebase-v1-SyncSheetsRequest"></a>
### SyncSheetsRequest
@@ -6933,6 +6952,24 @@ Format: projects/{project} |
+<a name="bytebase-v1-UpdateSheetOrganizerRequest"></a>
+
+### UpdateSheetOrganizerRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| organizer | [SheetOrganizer](#bytebase-v1-SheetOrganizer) | | The organizer to update.
+
+The organizer&#39;s `sheet` field is used to identify the sheet. Format: projects/{project}/sheets/{sheet} |
+| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | The list of fields to be updated. Fields are specified relative to the sheet organizer. Only support update the following fields for now: - `starred` - `pinned` |
+
+
+
+
+
+
<a name="bytebase-v1-UpdateSheetRequest"></a>
### UpdateSheetRequest
@@ -7010,6 +7047,7 @@ The sheet&#39;s `name` field is used to identify the sheet to update. Format: pr
| GetSheet | [GetSheetRequest](#bytebase-v1-GetSheetRequest) | [Sheet](#bytebase-v1-Sheet) | |
| SearchSheets | [SearchSheetsRequest](#bytebase-v1-SearchSheetsRequest) | [SearchSheetsResponse](#bytebase-v1-SearchSheetsResponse) | |
| UpdateSheet | [UpdateSheetRequest](#bytebase-v1-UpdateSheetRequest) | [Sheet](#bytebase-v1-Sheet) | |
+| UpdateSheetOrganizer | [UpdateSheetOrganizerRequest](#bytebase-v1-UpdateSheetOrganizerRequest) | [SheetOrganizer](#bytebase-v1-SheetOrganizer) | |
| DeleteSheet | [DeleteSheetRequest](#bytebase-v1-DeleteSheetRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
| SyncSheets | [SyncSheetsRequest](#bytebase-v1-SyncSheetsRequest) | [.google.protobuf.Empty](#google-protobuf-Empty) | |
diff --git a/proto/generated-go/v1/sheet_service.pb.go b/proto/generated-go/v1/sheet_service.pb.go
index 1cf0277456..b3c5fc18aa 100644
--- a/proto/generated-go/v1/sheet_service.pb.go
+++ b/proto/generated-go/v1/sheet_service.pb.go
@@ -76,7 +76,7 @@ func (x Sheet_Visibility) Number() protoreflect.EnumNumber {
// Deprecated: Use Sheet_Visibility.Descriptor instead.
func (Sheet_Visibility) EnumDescriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{7, 0}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{9, 0}
}
type Sheet_Source int32
@@ -139,7 +139,7 @@ func (x Sheet_Source) Number() protoreflect.EnumNumber {
// Deprecated: Use Sheet_Source.Descriptor instead.
func (Sheet_Source) EnumDescriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{7, 1}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{9, 1}
}
type Sheet_Type int32
@@ -185,7 +185,7 @@ func (x Sheet_Type) Number() protoreflect.EnumNumber {
// Deprecated: Use Sheet_Type.Descriptor instead.
func (Sheet_Type) EnumDescriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{7, 2}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{9, 2}
}
type CreateSheetRequest struct {
@@ -371,6 +371,137 @@ func (x *UpdateSheetRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
return nil
}
+type UpdateSheetOrganizerRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The organizer to update.
+ //
+ // The organizer's `sheet` field is used to identify the sheet.
+ // Format: projects/{project}/sheets/{sheet}
+ Organizer *SheetOrganizer `protobuf:"bytes,1,opt,name=organizer,proto3" json:"organizer,omitempty"`
+ // The list of fields to be updated.
+ // Fields are specified relative to the sheet organizer.
+ // Only support update the following fields for now:
+ // - `starred`
+ // - `pinned`
+ UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"`
+}
+
+func (x *UpdateSheetOrganizerRequest) Reset() {
+ *x = UpdateSheetOrganizerRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_sheet_service_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *UpdateSheetOrganizerRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*UpdateSheetOrganizerRequest) ProtoMessage() {}
+
+func (x *UpdateSheetOrganizerRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_sheet_service_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use UpdateSheetOrganizerRequest.ProtoReflect.Descriptor instead.
+func (*UpdateSheetOrganizerRequest) Descriptor() ([]byte, []int) {
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *UpdateSheetOrganizerRequest) GetOrganizer() *SheetOrganizer {
+ if x != nil {
+ return x.Organizer
+ }
+ return nil
+}
+
+func (x *UpdateSheetOrganizerRequest) GetUpdateMask() *fieldmaskpb.FieldMask {
+ if x != nil {
+ return x.UpdateMask
+ }
+ return nil
+}
+
+type SheetOrganizer struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The name of the sheet.
+ // Format: projects/{project}/sheets/{sheet}
+ Sheet string `protobuf:"bytes,1,opt,name=sheet,proto3" json:"sheet,omitempty"`
+ // starred means if the sheet is starred.
+ Starred bool `protobuf:"varint,2,opt,name=starred,proto3" json:"starred,omitempty"`
+ // pinned means if the sheet is pinned.
+ Pinned bool `protobuf:"varint,3,opt,name=pinned,proto3" json:"pinned,omitempty"`
+}
+
+func (x *SheetOrganizer) Reset() {
+ *x = SheetOrganizer{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_v1_sheet_service_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SheetOrganizer) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SheetOrganizer) ProtoMessage() {}
+
+func (x *SheetOrganizer) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_sheet_service_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SheetOrganizer.ProtoReflect.Descriptor instead.
+func (*SheetOrganizer) Descriptor() ([]byte, []int) {
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *SheetOrganizer) GetSheet() string {
+ if x != nil {
+ return x.Sheet
+ }
+ return ""
+}
+
+func (x *SheetOrganizer) GetStarred() bool {
+ if x != nil {
+ return x.Starred
+ }
+ return false
+}
+
+func (x *SheetOrganizer) GetPinned() bool {
+ if x != nil {
+ return x.Pinned
+ }
+ return false
+}
+
type DeleteSheetRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -384,7 +515,7 @@ type DeleteSheetRequest struct {
func (x *DeleteSheetRequest) Reset() {
*x = DeleteSheetRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_v1_sheet_service_proto_msgTypes[3]
+ mi := &file_v1_sheet_service_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -397,7 +528,7 @@ func (x *DeleteSheetRequest) String() string {
func (*DeleteSheetRequest) ProtoMessage() {}
func (x *DeleteSheetRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[3]
+ mi := &file_v1_sheet_service_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -410,7 +541,7 @@ func (x *DeleteSheetRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteSheetRequest.ProtoReflect.Descriptor instead.
func (*DeleteSheetRequest) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{3}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{5}
}
func (x *DeleteSheetRequest) GetName() string {
@@ -450,7 +581,7 @@ type SearchSheetsRequest struct {
func (x *SearchSheetsRequest) Reset() {
*x = SearchSheetsRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_v1_sheet_service_proto_msgTypes[4]
+ mi := &file_v1_sheet_service_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -463,7 +594,7 @@ func (x *SearchSheetsRequest) String() string {
func (*SearchSheetsRequest) ProtoMessage() {}
func (x *SearchSheetsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[4]
+ mi := &file_v1_sheet_service_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -476,7 +607,7 @@ func (x *SearchSheetsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchSheetsRequest.ProtoReflect.Descriptor instead.
func (*SearchSheetsRequest) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{4}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{6}
}
func (x *SearchSheetsRequest) GetParent() string {
@@ -522,7 +653,7 @@ type SearchSheetsResponse struct {
func (x *SearchSheetsResponse) Reset() {
*x = SearchSheetsResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_v1_sheet_service_proto_msgTypes[5]
+ mi := &file_v1_sheet_service_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -535,7 +666,7 @@ func (x *SearchSheetsResponse) String() string {
func (*SearchSheetsResponse) ProtoMessage() {}
func (x *SearchSheetsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[5]
+ mi := &file_v1_sheet_service_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -548,7 +679,7 @@ func (x *SearchSheetsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchSheetsResponse.ProtoReflect.Descriptor instead.
func (*SearchSheetsResponse) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{5}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{7}
}
func (x *SearchSheetsResponse) GetSheets() []*Sheet {
@@ -579,7 +710,7 @@ type SyncSheetsRequest struct {
func (x *SyncSheetsRequest) Reset() {
*x = SyncSheetsRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_v1_sheet_service_proto_msgTypes[6]
+ mi := &file_v1_sheet_service_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -592,7 +723,7 @@ func (x *SyncSheetsRequest) String() string {
func (*SyncSheetsRequest) ProtoMessage() {}
func (x *SyncSheetsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[6]
+ mi := &file_v1_sheet_service_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -605,7 +736,7 @@ func (x *SyncSheetsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SyncSheetsRequest.ProtoReflect.Descriptor instead.
func (*SyncSheetsRequest) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{6}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{8}
}
func (x *SyncSheetsRequest) GetParent() string {
@@ -657,7 +788,7 @@ type Sheet struct {
func (x *Sheet) Reset() {
*x = Sheet{}
if protoimpl.UnsafeEnabled {
- mi := &file_v1_sheet_service_proto_msgTypes[7]
+ mi := &file_v1_sheet_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -670,7 +801,7 @@ func (x *Sheet) String() string {
func (*Sheet) ProtoMessage() {}
func (x *Sheet) ProtoReflect() protoreflect.Message {
- mi := &file_v1_sheet_service_proto_msgTypes[7]
+ mi := &file_v1_sheet_service_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -683,7 +814,7 @@ func (x *Sheet) ProtoReflect() protoreflect.Message {
// Deprecated: Use Sheet.ProtoReflect.Descriptor instead.
func (*Sheet) Descriptor() ([]byte, []int) {
- return file_v1_sheet_service_proto_rawDescGZIP(), []int{7}
+ return file_v1_sheet_service_proto_rawDescGZIP(), []int{9}
}
func (x *Sheet) GetName() string {
@@ -812,131 +943,159 @@ var file_v1_sheet_service_proto_rawDesc = []byte{
0x73, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64,
0x4d, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b,
- 0x22, 0x2d, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22,
- 0x86, 0x01, 0x0a, 0x13, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e,
- 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x06, 0x70, 0x61,
- 0x72, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09,
- 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
- 0x08, 0x70, 0x61, 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67,
- 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70,
- 0x61, 0x67, 0x65, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x6a, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72,
- 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x12, 0x2a, 0x0a, 0x06, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x12, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53,
- 0x68, 0x65, 0x65, 0x74, 0x52, 0x06, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f,
- 0x6e, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54,
- 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, 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,
- 0x61, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1d,
- 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42,
- 0x03, 0xe0, 0x41, 0x03, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a,
- 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01,
- 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03,
- 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
- 0x40, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
- 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d,
- 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01,
- 0x28, 0x0c, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
- 0x12, 0x26, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65,
- 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6e,
- 0x74, 0x65, 0x6e, 0x74, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x42, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69,
- 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62,
- 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74,
- 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x03, 0xe0, 0x41, 0x02,
- 0x52, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x06,
- 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x62,
+ 0x22, 0x9a, 0x01, 0x0a, 0x1b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74,
+ 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x12, 0x3e, 0x0a, 0x09, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76,
+ 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72,
+ 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x09, 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72,
+ 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73,
+ 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x5d, 0x0a,
+ 0x0e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x12,
+ 0x19, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,
+ 0xe0, 0x41, 0x02, 0x52, 0x05, 0x73, 0x68, 0x65, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x74,
+ 0x61, 0x72, 0x72, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73, 0x74, 0x61,
+ 0x72, 0x72, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x18, 0x03,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x70, 0x69, 0x6e, 0x6e, 0x65, 0x64, 0x22, 0x2d, 0x0a, 0x12,
+ 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x12, 0x17, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x86, 0x01, 0x0a, 0x13,
+ 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68, 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x06, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74,
+ 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x06, 0x66, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65,
+ 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67,
+ 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f,
+ 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x61, 0x67, 0x65, 0x54,
+ 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x6a, 0x0a, 0x14, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x53, 0x68,
+ 0x65, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x06,
+ 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x62,
0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74,
- 0x2e, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x06, 0x73, 0x6f,
- 0x75, 0x72, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01,
- 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
- 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,
- 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, 0x06, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x65, 0x78, 0x74,
+ 0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x0d, 0x6e, 0x65, 0x78, 0x74, 0x50, 0x61, 0x67, 0x65, 0x54, 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, 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, 0x61, 0x73, 0x65, 0x12,
+ 0x19, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03,
+ 0xe0, 0x41, 0x02, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x07, 0x63, 0x72,
+ 0x65, 0x61, 0x74, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x03, 0xe0, 0x41, 0x03,
+ 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x40, 0x0a, 0x0b, 0x63, 0x72, 0x65,
+ 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a,
+ 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
+ 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52,
+ 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x40, 0x0a, 0x0b, 0x75,
+ 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
+ 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x03, 0xe0, 0x41,
+ 0x03, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x1d, 0x0a,
+ 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x03,
+ 0xe0, 0x41, 0x02, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x26, 0x0a, 0x0c,
+ 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x08, 0x20, 0x01,
+ 0x28, 0x03, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
+ 0x53, 0x69, 0x7a, 0x65, 0x12, 0x42, 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69,
+ 0x74, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x2e, 0x56, 0x69, 0x73,
+ 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x42, 0x03, 0xe0, 0x41, 0x02, 0x52, 0x0a, 0x76, 0x69,
+ 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x12, 0x36, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72,
+ 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62,
+ 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74, 0x2e, 0x53, 0x6f, 0x75,
+ 0x72, 0x63, 0x65, 0x42, 0x03, 0xe0, 0x41, 0x03, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17,
+ 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 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, 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, 0xc4, 0x07, 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, 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, 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,
+ 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, 0xbd, 0x01, 0x0a, 0x14, 0x55, 0x70,
+ 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a,
+ 0x65, 0x72, 0x12, 0x28, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31,
+ 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x4f, 0x72, 0x67, 0x61,
+ 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x62,
+ 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x68, 0x65, 0x65, 0x74,
+ 0x4f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x22, 0x5e, 0xda, 0x41, 0x15, 0x6f, 0x72,
+ 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d,
+ 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x40, 0x3a, 0x09, 0x6f, 0x72, 0x67, 0x61, 0x6e,
+ 0x69, 0x7a, 0x65, 0x72, 0x1a, 0x33, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x6f, 0x72, 0x67, 0x61, 0x6e,
+ 0x69, 0x7a, 0x65, 0x72, 0x2e, 0x73, 0x68, 0x65, 0x65, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65,
+ 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x2f, 0x73, 0x68, 0x65, 0x65, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f,
+ 0x6f, 0x72, 0x67, 0x61, 0x6e, 0x69, 0x7a, 0x65, 0x72, 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 (
@@ -952,50 +1111,56 @@ func file_v1_sheet_service_proto_rawDescGZIP() []byte {
}
var file_v1_sheet_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_v1_sheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_v1_sheet_service_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
var file_v1_sheet_service_proto_goTypes = []interface{}{
- (Sheet_Visibility)(0), // 0: bytebase.v1.Sheet.Visibility
- (Sheet_Source)(0), // 1: bytebase.v1.Sheet.Source
- (Sheet_Type)(0), // 2: bytebase.v1.Sheet.Type
- (*CreateSheetRequest)(nil), // 3: bytebase.v1.CreateSheetRequest
- (*GetSheetRequest)(nil), // 4: bytebase.v1.GetSheetRequest
- (*UpdateSheetRequest)(nil), // 5: bytebase.v1.UpdateSheetRequest
- (*DeleteSheetRequest)(nil), // 6: bytebase.v1.DeleteSheetRequest
- (*SearchSheetsRequest)(nil), // 7: bytebase.v1.SearchSheetsRequest
- (*SearchSheetsResponse)(nil), // 8: bytebase.v1.SearchSheetsResponse
- (*SyncSheetsRequest)(nil), // 9: bytebase.v1.SyncSheetsRequest
- (*Sheet)(nil), // 10: bytebase.v1.Sheet
- (*fieldmaskpb.FieldMask)(nil), // 11: google.protobuf.FieldMask
- (*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp
- (*emptypb.Empty)(nil), // 13: google.protobuf.Empty
+ (Sheet_Visibility)(0), // 0: bytebase.v1.Sheet.Visibility
+ (Sheet_Source)(0), // 1: bytebase.v1.Sheet.Source
+ (Sheet_Type)(0), // 2: bytebase.v1.Sheet.Type
+ (*CreateSheetRequest)(nil), // 3: bytebase.v1.CreateSheetRequest
+ (*GetSheetRequest)(nil), // 4: bytebase.v1.GetSheetRequest
+ (*UpdateSheetRequest)(nil), // 5: bytebase.v1.UpdateSheetRequest
+ (*UpdateSheetOrganizerRequest)(nil), // 6: bytebase.v1.UpdateSheetOrganizerRequest
+ (*SheetOrganizer)(nil), // 7: bytebase.v1.SheetOrganizer
+ (*DeleteSheetRequest)(nil), // 8: bytebase.v1.DeleteSheetRequest
+ (*SearchSheetsRequest)(nil), // 9: bytebase.v1.SearchSheetsRequest
+ (*SearchSheetsResponse)(nil), // 10: bytebase.v1.SearchSheetsResponse
+ (*SyncSheetsRequest)(nil), // 11: bytebase.v1.SyncSheetsRequest
+ (*Sheet)(nil), // 12: bytebase.v1.Sheet
+ (*fieldmaskpb.FieldMask)(nil), // 13: google.protobuf.FieldMask
+ (*timestamppb.Timestamp)(nil), // 14: google.protobuf.Timestamp
+ (*emptypb.Empty)(nil), // 15: google.protobuf.Empty
}
var file_v1_sheet_service_proto_depIdxs = []int32{
- 10, // 0: bytebase.v1.CreateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
- 10, // 1: bytebase.v1.UpdateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
- 11, // 2: bytebase.v1.UpdateSheetRequest.update_mask:type_name -> google.protobuf.FieldMask
- 10, // 3: bytebase.v1.SearchSheetsResponse.sheets:type_name -> bytebase.v1.Sheet
- 12, // 4: bytebase.v1.Sheet.create_time:type_name -> google.protobuf.Timestamp
- 12, // 5: bytebase.v1.Sheet.update_time:type_name -> google.protobuf.Timestamp
- 0, // 6: bytebase.v1.Sheet.visibility:type_name -> bytebase.v1.Sheet.Visibility
- 1, // 7: bytebase.v1.Sheet.source:type_name -> bytebase.v1.Sheet.Source
- 2, // 8: bytebase.v1.Sheet.type:type_name -> bytebase.v1.Sheet.Type
- 3, // 9: bytebase.v1.SheetService.CreateSheet:input_type -> bytebase.v1.CreateSheetRequest
- 4, // 10: bytebase.v1.SheetService.GetSheet:input_type -> bytebase.v1.GetSheetRequest
- 7, // 11: bytebase.v1.SheetService.SearchSheets:input_type -> bytebase.v1.SearchSheetsRequest
- 5, // 12: bytebase.v1.SheetService.UpdateSheet:input_type -> bytebase.v1.UpdateSheetRequest
- 6, // 13: bytebase.v1.SheetService.DeleteSheet:input_type -> bytebase.v1.DeleteSheetRequest
- 9, // 14: bytebase.v1.SheetService.SyncSheets:input_type -> bytebase.v1.SyncSheetsRequest
- 10, // 15: bytebase.v1.SheetService.CreateSheet:output_type -> bytebase.v1.Sheet
- 10, // 16: bytebase.v1.SheetService.GetSheet:output_type -> bytebase.v1.Sheet
- 8, // 17: bytebase.v1.SheetService.SearchSheets:output_type -> bytebase.v1.SearchSheetsResponse
- 10, // 18: bytebase.v1.SheetService.UpdateSheet:output_type -> bytebase.v1.Sheet
- 13, // 19: bytebase.v1.SheetService.DeleteSheet:output_type -> google.protobuf.Empty
- 13, // 20: bytebase.v1.SheetService.SyncSheets:output_type -> google.protobuf.Empty
- 15, // [15:21] is the sub-list for method output_type
- 9, // [9:15] is the sub-list for method input_type
- 9, // [9:9] is the sub-list for extension type_name
- 9, // [9:9] is the sub-list for extension extendee
- 0, // [0:9] is the sub-list for field type_name
+ 12, // 0: bytebase.v1.CreateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
+ 12, // 1: bytebase.v1.UpdateSheetRequest.sheet:type_name -> bytebase.v1.Sheet
+ 13, // 2: bytebase.v1.UpdateSheetRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 7, // 3: bytebase.v1.UpdateSheetOrganizerRequest.organizer:type_name -> bytebase.v1.SheetOrganizer
+ 13, // 4: bytebase.v1.UpdateSheetOrganizerRequest.update_mask:type_name -> google.protobuf.FieldMask
+ 12, // 5: bytebase.v1.SearchSheetsResponse.sheets:type_name -> bytebase.v1.Sheet
+ 14, // 6: bytebase.v1.Sheet.create_time:type_name -> google.protobuf.Timestamp
+ 14, // 7: bytebase.v1.Sheet.update_time:type_name -> google.protobuf.Timestamp
+ 0, // 8: bytebase.v1.Sheet.visibility:type_name -> bytebase.v1.Sheet.Visibility
+ 1, // 9: bytebase.v1.Sheet.source:type_name -> bytebase.v1.Sheet.Source
+ 2, // 10: bytebase.v1.Sheet.type:type_name -> bytebase.v1.Sheet.Type
+ 3, // 11: bytebase.v1.SheetService.CreateSheet:input_type -> bytebase.v1.CreateSheetRequest
+ 4, // 12: bytebase.v1.SheetService.GetSheet:input_type -> bytebase.v1.GetSheetRequest
+ 9, // 13: bytebase.v1.SheetService.SearchSheets:input_type -> bytebase.v1.SearchSheetsRequest
+ 5, // 14: bytebase.v1.SheetService.UpdateSheet:input_type -> bytebase.v1.UpdateSheetRequest
+ 6, // 15: bytebase.v1.SheetService.UpdateSheetOrganizer:input_type -> bytebase.v1.UpdateSheetOrganizerRequest
+ 8, // 16: bytebase.v1.SheetService.DeleteSheet:input_type -> bytebase.v1.DeleteSheetRequest
+ 11, // 17: bytebase.v1.SheetService.SyncSheets:input_type -> bytebase.v1.SyncSheetsRequest
+ 12, // 18: bytebase.v1.SheetService.CreateSheet:output_type -> bytebase.v1.Sheet
+ 12, // 19: bytebase.v1.SheetService.GetSheet:output_type -> bytebase.v1.Sheet
+ 10, // 20: bytebase.v1.SheetService.SearchSheets:output_type -> bytebase.v1.SearchSheetsResponse
+ 12, // 21: bytebase.v1.SheetService.UpdateSheet:output_type -> bytebase.v1.Sheet
+ 7, // 22: bytebase.v1.SheetService.UpdateSheetOrganizer:output_type -> bytebase.v1.SheetOrganizer
+ 15, // 23: bytebase.v1.SheetService.DeleteSheet:output_type -> google.protobuf.Empty
+ 15, // 24: bytebase.v1.SheetService.SyncSheets:output_type -> google.protobuf.Empty
+ 18, // [18:25] is the sub-list for method output_type
+ 11, // [11:18] is the sub-list for method input_type
+ 11, // [11:11] is the sub-list for extension type_name
+ 11, // [11:11] is the sub-list for extension extendee
+ 0, // [0:11] is the sub-list for field type_name
}
func init() { file_v1_sheet_service_proto_init() }
@@ -1041,7 +1206,7 @@ func file_v1_sheet_service_proto_init() {
}
}
file_v1_sheet_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*DeleteSheetRequest); i {
+ switch v := v.(*UpdateSheetOrganizerRequest); i {
case 0:
return &v.state
case 1:
@@ -1053,7 +1218,7 @@ func file_v1_sheet_service_proto_init() {
}
}
file_v1_sheet_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SearchSheetsRequest); i {
+ switch v := v.(*SheetOrganizer); i {
case 0:
return &v.state
case 1:
@@ -1065,7 +1230,7 @@ func file_v1_sheet_service_proto_init() {
}
}
file_v1_sheet_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SearchSheetsResponse); i {
+ switch v := v.(*DeleteSheetRequest); i {
case 0:
return &v.state
case 1:
@@ -1077,7 +1242,7 @@ func file_v1_sheet_service_proto_init() {
}
}
file_v1_sheet_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SyncSheetsRequest); i {
+ switch v := v.(*SearchSheetsRequest); i {
case 0:
return &v.state
case 1:
@@ -1089,6 +1254,30 @@ func file_v1_sheet_service_proto_init() {
}
}
file_v1_sheet_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SearchSheetsResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_sheet_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SyncSheetsRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_v1_sheet_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Sheet); i {
case 0:
return &v.state
@@ -1107,7 +1296,7 @@ func file_v1_sheet_service_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_v1_sheet_service_proto_rawDesc,
NumEnums: 3,
- NumMessages: 8,
+ NumMessages: 10,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/generated-go/v1/sheet_service.pb.gw.go b/proto/generated-go/v1/sheet_service.pb.gw.go
index 125769a721..23a99529f9 100644
--- a/proto/generated-go/v1/sheet_service.pb.gw.go
+++ b/proto/generated-go/v1/sheet_service.pb.gw.go
@@ -339,6 +339,92 @@ func local_request_SheetService_UpdateSheet_0(ctx context.Context, marshaler run
}
+var (
+ filter_SheetService_UpdateSheetOrganizer_0 = &utilities.DoubleArray{Encoding: map[string]int{"organizer": 0, "sheet": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}}
+)
+
+func request_SheetService_UpdateSheetOrganizer_0(ctx context.Context, marshaler runtime.Marshaler, client SheetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq UpdateSheetOrganizerRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Organizer); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["organizer.sheet"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "organizer.sheet")
+ }
+
+ err = runtime.PopulateFieldFromPath(&protoReq, "organizer.sheet", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "organizer.sheet", err)
+ }
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SheetService_UpdateSheetOrganizer_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := client.UpdateSheetOrganizer(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+
+}
+
+func local_request_SheetService_UpdateSheetOrganizer_0(ctx context.Context, marshaler runtime.Marshaler, server SheetServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var protoReq UpdateSheetOrganizerRequest
+ var metadata runtime.ServerMetadata
+
+ newReader, berr := utilities.IOReaderFactory(req.Body)
+ if berr != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr)
+ }
+ if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Organizer); err != nil && err != io.EOF {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ var (
+ val string
+ ok bool
+ err error
+ _ = err
+ )
+
+ val, ok = pathParams["organizer.sheet"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "organizer.sheet")
+ }
+
+ err = runtime.PopulateFieldFromPath(&protoReq, "organizer.sheet", val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "organizer.sheet", err)
+ }
+
+ if err := req.ParseForm(); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SheetService_UpdateSheetOrganizer_0); err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+
+ msg, err := server.UpdateSheetOrganizer(ctx, &protoReq)
+ return msg, metadata, err
+
+}
+
func request_SheetService_DeleteSheet_0(ctx context.Context, marshaler runtime.Marshaler, client SheetServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq DeleteSheetRequest
var metadata runtime.ServerMetadata
@@ -549,6 +635,31 @@ func RegisterSheetServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu
})
+ mux.Handle("PUT", pattern_SheetService_UpdateSheetOrganizer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.SheetService/UpdateSheetOrganizer", runtime.WithHTTPPathPattern("/v1/{organizer.sheet=projects/*/sheets/*}/organizer"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_SheetService_UpdateSheetOrganizer_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_SheetService_UpdateSheetOrganizer_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("DELETE", pattern_SheetService_DeleteSheet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -728,6 +839,28 @@ func RegisterSheetServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu
})
+ mux.Handle("PUT", pattern_SheetService_UpdateSheetOrganizer_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ var err error
+ var annotatedContext context.Context
+ annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.SheetService/UpdateSheetOrganizer", runtime.WithHTTPPathPattern("/v1/{organizer.sheet=projects/*/sheets/*}/organizer"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_SheetService_UpdateSheetOrganizer_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+
+ forward_SheetService_UpdateSheetOrganizer_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+
+ })
+
mux.Handle("DELETE", pattern_SheetService_DeleteSheet_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@@ -784,6 +917,8 @@ var (
pattern_SheetService_UpdateSheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "sheets", "sheet.name"}, ""))
+ pattern_SheetService_UpdateSheetOrganizer_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3, 2, 4}, []string{"v1", "projects", "sheets", "organizer.sheet", "organizer"}, ""))
+
pattern_SheetService_DeleteSheet_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "sheets", "name"}, ""))
pattern_SheetService_SyncSheets_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "sheets"}, "sync"))
@@ -798,6 +933,8 @@ var (
forward_SheetService_UpdateSheet_0 = runtime.ForwardResponseMessage
+ forward_SheetService_UpdateSheetOrganizer_0 = runtime.ForwardResponseMessage
+
forward_SheetService_DeleteSheet_0 = runtime.ForwardResponseMessage
forward_SheetService_SyncSheets_0 = runtime.ForwardResponseMessage
diff --git a/proto/generated-go/v1/sheet_service_grpc.pb.go b/proto/generated-go/v1/sheet_service_grpc.pb.go
index c2f31d1c8f..9c8c91551a 100644
--- a/proto/generated-go/v1/sheet_service_grpc.pb.go
+++ b/proto/generated-go/v1/sheet_service_grpc.pb.go
@@ -20,12 +20,13 @@ import (
const _ = grpc.SupportPackageIsVersion7
const (
- SheetService_CreateSheet_FullMethodName = "/bytebase.v1.SheetService/CreateSheet"
- SheetService_GetSheet_FullMethodName = "/bytebase.v1.SheetService/GetSheet"
- SheetService_SearchSheets_FullMethodName = "/bytebase.v1.SheetService/SearchSheets"
- SheetService_UpdateSheet_FullMethodName = "/bytebase.v1.SheetService/UpdateSheet"
- SheetService_DeleteSheet_FullMethodName = "/bytebase.v1.SheetService/DeleteSheet"
- SheetService_SyncSheets_FullMethodName = "/bytebase.v1.SheetService/SyncSheets"
+ SheetService_CreateSheet_FullMethodName = "/bytebase.v1.SheetService/CreateSheet"
+ SheetService_GetSheet_FullMethodName = "/bytebase.v1.SheetService/GetSheet"
+ SheetService_SearchSheets_FullMethodName = "/bytebase.v1.SheetService/SearchSheets"
+ SheetService_UpdateSheet_FullMethodName = "/bytebase.v1.SheetService/UpdateSheet"
+ SheetService_UpdateSheetOrganizer_FullMethodName = "/bytebase.v1.SheetService/UpdateSheetOrganizer"
+ SheetService_DeleteSheet_FullMethodName = "/bytebase.v1.SheetService/DeleteSheet"
+ SheetService_SyncSheets_FullMethodName = "/bytebase.v1.SheetService/SyncSheets"
)
// SheetServiceClient is the client API for SheetService service.
@@ -36,6 +37,7 @@ type SheetServiceClient interface {
GetSheet(ctx context.Context, in *GetSheetRequest, opts ...grpc.CallOption) (*Sheet, error)
SearchSheets(ctx context.Context, in *SearchSheetsRequest, opts ...grpc.CallOption) (*SearchSheetsResponse, error)
UpdateSheet(ctx context.Context, in *UpdateSheetRequest, opts ...grpc.CallOption) (*Sheet, error)
+ UpdateSheetOrganizer(ctx context.Context, in *UpdateSheetOrganizerRequest, opts ...grpc.CallOption) (*SheetOrganizer, error)
DeleteSheet(ctx context.Context, in *DeleteSheetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
SyncSheets(ctx context.Context, in *SyncSheetsRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}
@@ -84,6 +86,15 @@ func (c *sheetServiceClient) UpdateSheet(ctx context.Context, in *UpdateSheetReq
return out, nil
}
+func (c *sheetServiceClient) UpdateSheetOrganizer(ctx context.Context, in *UpdateSheetOrganizerRequest, opts ...grpc.CallOption) (*SheetOrganizer, error) {
+ out := new(SheetOrganizer)
+ err := c.cc.Invoke(ctx, SheetService_UpdateSheetOrganizer_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
func (c *sheetServiceClient) DeleteSheet(ctx context.Context, in *DeleteSheetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, SheetService_DeleteSheet_FullMethodName, in, out, opts...)
@@ -110,6 +121,7 @@ type SheetServiceServer interface {
GetSheet(context.Context, *GetSheetRequest) (*Sheet, error)
SearchSheets(context.Context, *SearchSheetsRequest) (*SearchSheetsResponse, error)
UpdateSheet(context.Context, *UpdateSheetRequest) (*Sheet, error)
+ UpdateSheetOrganizer(context.Context, *UpdateSheetOrganizerRequest) (*SheetOrganizer, error)
DeleteSheet(context.Context, *DeleteSheetRequest) (*emptypb.Empty, error)
SyncSheets(context.Context, *SyncSheetsRequest) (*emptypb.Empty, error)
mustEmbedUnimplementedSheetServiceServer()
@@ -131,6 +143,9 @@ func (UnimplementedSheetServiceServer) SearchSheets(context.Context, *SearchShee
func (UnimplementedSheetServiceServer) UpdateSheet(context.Context, *UpdateSheetRequest) (*Sheet, error) {
return nil, status.Errorf(codes.Unimplemented, "method UpdateSheet not implemented")
}
+func (UnimplementedSheetServiceServer) UpdateSheetOrganizer(context.Context, *UpdateSheetOrganizerRequest) (*SheetOrganizer, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method UpdateSheetOrganizer not implemented")
+}
func (UnimplementedSheetServiceServer) DeleteSheet(context.Context, *DeleteSheetRequest) (*emptypb.Empty, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSheet not implemented")
}
@@ -222,6 +237,24 @@ func _SheetService_UpdateSheet_Handler(srv interface{}, ctx context.Context, dec
return interceptor(ctx, in, info, handler)
}
+func _SheetService_UpdateSheetOrganizer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(UpdateSheetOrganizerRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(SheetServiceServer).UpdateSheetOrganizer(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: SheetService_UpdateSheetOrganizer_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(SheetServiceServer).UpdateSheetOrganizer(ctx, req.(*UpdateSheetOrganizerRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
func _SheetService_DeleteSheet_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteSheetRequest)
if err := dec(in); err != nil {
@@ -281,6 +314,10 @@ var SheetService_ServiceDesc = grpc.ServiceDesc{
MethodName: "UpdateSheet",
Handler: _SheetService_UpdateSheet_Handler,
},
+ {
+ MethodName: "UpdateSheetOrganizer",
+ Handler: _SheetService_UpdateSheetOrganizer_Handler,
+ },
{
MethodName: "DeleteSheet",
Handler: _SheetService_DeleteSheet_Handler,
diff --git a/proto/v1/sheet_service.proto b/proto/v1/sheet_service.proto
index 759d054394..022af2258b 100644
--- a/proto/v1/sheet_service.proto
+++ b/proto/v1/sheet_service.proto
@@ -37,6 +37,14 @@ service SheetService {
option (google.api.method_signature) = "sheet,update_mask";
}
+ rpc UpdateSheetOrganizer(UpdateSheetOrganizerRequest) returns (SheetOrganizer) {
+ option (google.api.http) = {
+ put: "/v1/{organizer.sheet=projects/*/sheets/*}/organizer"
+ body: "organizer"
+ };
+ option (google.api.method_signature) = "organizer,update_mask";
+ }
+
rpc DeleteSheet(DeleteSheetRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {delete: "/v1/{name=projects/*/sheets/*}"};
option (google.api.method_signature) = "name";
@@ -84,6 +92,33 @@ message UpdateSheetRequest {
google.protobuf.FieldMask update_mask = 2;
}
+message UpdateSheetOrganizerRequest {
+ // The organizer to update.
+ //
+ // The organizer's `sheet` field is used to identify the sheet.
+ // Format: projects/{project}/sheets/{sheet}
+ SheetOrganizer organizer = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // The list of fields to be updated.
+ // Fields are specified relative to the sheet organizer.
+ // Only support update the following fields for now:
+ // - `starred`
+ // - `pinned`
+ google.protobuf.FieldMask update_mask = 2;
+}
+
+message SheetOrganizer {
+ // The name of the sheet.
+ // Format: projects/{project}/sheets/{sheet}
+ string sheet = 1 [(google.api.field_behavior) = REQUIRED];
+
+ // starred means if the sheet is starred.
+ bool starred = 2;
+
+ // pinned means if the sheet is pinned.
+ bool pinned = 3;
+}
+
message DeleteSheetRequest {
// The name of the sheet to delete.
// Format: projects/{project}/sheets/{sheet}