diff --git a/Makefile b/Makefile index fddc75cc..41d0e74b 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,7 @@ endif ##--------------------------------------------------------------------- ##@ Test ##--------------------------------------------------------------------- -TEST_FILES ?= ./... ./traefik/plugins/cosmo-workspace/cosmoauth/ +TEST_FILES ?= ./... ./traefik-plugins/src/github.com/cosmo-workspace/cosmoauth/ COVER_PROFILE ?= cover.out #TEST_OPTS ?= --ginkgo.focus 'Dashboard server \[User\]' -ginkgo.v -ginkgo.progress -test.v > test.out 2>&1 diff --git a/charts/cosmo/templates/dashboard/ingressroute.yaml b/charts/cosmo/templates/dashboard/ingressroute.yaml index 72bad099..646f0b77 100644 --- a/charts/cosmo/templates/dashboard/ingressroute.yaml +++ b/charts/cosmo/templates/dashboard/ingressroute.yaml @@ -19,7 +19,7 @@ spec: routes: {{- if .Values.dashboard.localRunTest.enabled }} - kind: Rule - match: Host(`{{ .Values.dashboard.ingressRoute.host }}.{{ .Values.domain }}`) && (Path(`/`) || PathPrefix(`/@`) || PathPrefix(`/src`) || PathPrefix(`/manifest.json`) || PathPrefix(`/node_modules`) || PathPrefix(`/logo`)) + match: Host(`{{ .Values.dashboard.ingressRoute.host }}.{{ .Values.domain }}`) && (Path(`/`) || PathPrefix(`/@`) || PathPrefix(`/src`) || PathPrefix(`/manifest.json`) || PathPrefix(`/node_modules`) || PathPrefix(`/logo`)) || PathPrefix(`/favicon.ico`)) priority: 1002 services: - kind: Service diff --git a/hack/local-run-test/Makefile b/hack/local-run-test/Makefile index 936186f5..56c53709 100644 --- a/hack/local-run-test/Makefile +++ b/hack/local-run-test/Makefile @@ -264,7 +264,6 @@ install-cosmo-local: helm kubectl ## Install cosmo resources. @echo ====== $@ ====== helm upgrade --install cosmo ../../charts/cosmo \ -n cosmo-system --create-namespace \ - --wait \ --set domain="\$(DOMAIN)" \ --set urlbase.host="\$(DEFAULT_URLBASE_HOST)" \ --set controllerManager.image.repository=cosmo.io:5000/cosmo-controller-manager \ @@ -353,6 +352,8 @@ create-cosmo-resources: apply-template add-user add-workspace cg run-manager-local: go @echo ====== $@ ====== @#(cd ../.. && bash hack/download-certs.sh webhook-server-cert && make run QUICK_BUILD=yes) + cd ../.. && rm -f ./cmd/controller-manager/*.tar.gz && make embed-traefik-plugins + (sleep 8 && kubectl rollout restart deploy/traefik -n cosmo-system) & cd ../.. && bash hack/download-certs.sh webhook-server-cert && \ $(GO) run ./cmd/controller-manager/main.go \ --metrics-bind-address :8085 \ diff --git a/internal/cmd/user/create.go b/internal/cmd/user/create.go index 0b842403..f0a6c157 100644 --- a/internal/cmd/user/create.go +++ b/internal/cmd/user/create.go @@ -142,6 +142,7 @@ func (o *CreateOption) CreateUserWithDashClient(ctx context.Context) (*dashv1alp Addons: o.userAddons, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("UserServiceClient.CreateUser", "req", req) res, err := c.UserServiceClient.CreateUser(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -153,6 +154,8 @@ func (o *CreateOption) CreateUserWithDashClient(ctx context.Context) (*dashv1alp func (o *CreateOption) CreateUserWithKubeClient(ctx context.Context) (*dashv1alpha1.User, error) { c := o.KosmoClient + + o.Logr.DebugAll().Info("CreateUser", "userName", o.UserName, "displayName", o.DisplayName, "role", o.Roles, "authType", o.AuthType, "addons", apiconv.D2C_UserAddons(o.userAddons)) user, err := c.CreateUser(ctx, o.UserName, o.DisplayName, o.Roles, o.AuthType, apiconv.D2C_UserAddons(o.userAddons)) if err != nil { return nil, err diff --git a/internal/cmd/user/delete.go b/internal/cmd/user/delete.go index c33a1b2e..ea44fba3 100644 --- a/internal/cmd/user/delete.go +++ b/internal/cmd/user/delete.go @@ -102,6 +102,7 @@ func (o *DeleteOption) DeleteUserWithDashClient(ctx context.Context, userName st UserName: userName, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("UserServiceClient.DeleteUser", "req", req) res, err := c.UserServiceClient.DeleteUser(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/user/get.go b/internal/cmd/user/get.go index 31cdc46a..fc9d1a6f 100644 --- a/internal/cmd/user/get.go +++ b/internal/cmd/user/get.go @@ -192,20 +192,13 @@ func (o *GetOption) ApplyFilters(users []*dashv1alpha1.User) []*dashv1alpha1.Use } } - if len(o.UserNames) > 0 { - ts := make([]*dashv1alpha1.User, 0, len(o.UserNames)) - UserLoop: - // Or loop - for _, t := range users { - for _, selected := range o.UserNames { - if selected == t.GetName() { - ts = append(ts, t) - continue UserLoop - } - } - } - users = ts + // name filter + for _, userName := range o.UserNames { + users = cli.DoFilter(users, func(u *dashv1alpha1.User) []string { + return []string{u.Name} + }, cli.Filter{Operator: cli.OperatorEqual, Value: userName}) } + return users } diff --git a/internal/cmd/user/get_addons.go b/internal/cmd/user/get_addons.go index 27191c1e..47998c7d 100644 --- a/internal/cmd/user/get_addons.go +++ b/internal/cmd/user/get_addons.go @@ -113,6 +113,7 @@ func (o *GetAddonsOption) ListUserAddonsWithDashClient(ctx context.Context, with WithRaw: ptr.To(withRaw), } c := o.CosmoDashClient + o.Logr.DebugAll().Info("TemplateServiceClient.GetUserAddonTemplates", "req", req) res, err := c.TemplateServiceClient.GetUserAddonTemplates(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -147,20 +148,13 @@ func (o *GetAddonsOption) ApplyFilters(tmpls []*dashv1alpha1.Template) []*dashv1 } } - if len(o.AddonNames) > 0 { - ts := make([]*dashv1alpha1.Template, 0, len(o.AddonNames)) - UserLoop: - // Or loop - for _, t := range tmpls { - for _, selected := range o.AddonNames { - if selected == t.GetName() { - ts = append(ts, t) - continue UserLoop - } - } - } - tmpls = ts + // name filter + for _, addonName := range o.AddonNames { + tmpls = cli.DoFilter(tmpls, func(u *dashv1alpha1.Template) []string { + return []string{u.Name} + }, cli.Filter{Operator: cli.OperatorEqual, Value: addonName}) } + return tmpls } diff --git a/internal/cmd/user/get_events.go b/internal/cmd/user/get_events.go index 64b67459..4b85e5fd 100644 --- a/internal/cmd/user/get_events.go +++ b/internal/cmd/user/get_events.go @@ -90,6 +90,7 @@ func (o *GetEventsOption) GetEventsWithDashClient(ctx context.Context) ([]*dashv UserName: o.UserName, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("UserServiceClient.GetUser", "req", req) res, err := c.UserServiceClient.GetEvents(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to get events: %w", err) diff --git a/internal/cmd/user/update_addon.go b/internal/cmd/user/update_addon.go index 6a37d196..a9ec9967 100644 --- a/internal/cmd/user/update_addon.go +++ b/internal/cmd/user/update_addon.go @@ -133,6 +133,7 @@ func (o *UpdateAddonOption) UpdateUserWithDashClient(ctx context.Context) (*dash UserName: o.UserName, Addons: o.userAddons, } + o.Logr.DebugAll().Info("UserServiceClient.UpdateUserAddons", "req", req) res, err := c.UserServiceClient.UpdateUserAddons(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -148,6 +149,7 @@ func (o *UpdateAddonOption) UpdateUserWithKubeClient(ctx context.Context) (*dash UserAddons: apiconv.D2C_UserAddons(o.userAddons), } + o.Logr.DebugAll().Info("UpdateUser", "opts", opts) user, err := c.UpdateUser(ctx, o.UserName, opts) if err != nil { return nil, err diff --git a/internal/cmd/user/update_display_name.go b/internal/cmd/user/update_display_name.go index 5363475d..8ba8c1aa 100644 --- a/internal/cmd/user/update_display_name.go +++ b/internal/cmd/user/update_display_name.go @@ -122,6 +122,7 @@ func (o *UpdateDisplayNameOption) UpdateUserDisplayNameWithDashClient(ctx contex DisplayName: o.DisplayName, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("UserServiceClient.UpdateUserDisplayName", "req", req) res, err := c.UserServiceClient.UpdateUserDisplayName(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -138,6 +139,7 @@ func (o *UpdateDisplayNameOption) UpdateUserDisplayNameWithKubeClient(ctx contex DisplayName: ptr.To(o.UserName), } + o.Logr.DebugAll().Info("UpdateUser", "opts", opts) user, err := c.UpdateUser(ctx, o.UserName, opts) if err != nil { return nil, err @@ -151,6 +153,7 @@ func (o *UpdateDisplayNameOption) GetUserWithDashClient(ctx context.Context) (*d req := &dashv1alpha1.GetUserRequest{ UserName: o.UserName, } + o.Logr.DebugAll().Info("UserServiceClient.GetUser", "req", req) c := o.CosmoDashClient res, err := c.UserServiceClient.GetUser(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { diff --git a/internal/cmd/user/update_role.go b/internal/cmd/user/update_role.go index d3711784..bf55ab47 100644 --- a/internal/cmd/user/update_role.go +++ b/internal/cmd/user/update_role.go @@ -129,6 +129,7 @@ func (o *UpdateRoleOption) UpdateUserRoleWithDashClient(ctx context.Context) (*d UserName: o.UserName, Roles: o.Roles, } + o.Logr.DebugAll().Info("UserServiceClient.UpdateUserRole", "req", req) c := o.CosmoDashClient res, err := c.UserServiceClient.UpdateUserRole(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { @@ -144,6 +145,7 @@ func (o *UpdateRoleOption) UpdateUserRoleWithKubeClient(ctx context.Context) (*d opts := kosmo.UpdateUserOpts{ UserRoles: apiconv.S2C_UserRoles(o.Roles), } + o.Logr.DebugAll().Info("UpdateUser", "opts", opts) user, err := c.UpdateUser(ctx, o.UserName, opts) if err != nil { return nil, err @@ -158,6 +160,7 @@ func (o *UpdateRoleOption) GetUserWithDashClient(ctx context.Context) (*dashv1al UserName: o.UserName, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("UserServiceClient.GetUser", "req", req) res, err := c.UserServiceClient.GetUser(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/workspace/create.go b/internal/cmd/workspace/create.go index e121a2a8..9dd99667 100644 --- a/internal/cmd/workspace/create.go +++ b/internal/cmd/workspace/create.go @@ -135,6 +135,7 @@ func (o *CreateOption) CreateWorkspaceWithDashClient(ctx context.Context) (*dash Vars: o.vars, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("WorkspaceServiceClient.CreateWorkspace", "req", req) res, err := c.WorkspaceServiceClient.CreateWorkspace(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/workspace/delete.go b/internal/cmd/workspace/delete.go index 3cbd4166..273ee1b5 100644 --- a/internal/cmd/workspace/delete.go +++ b/internal/cmd/workspace/delete.go @@ -112,6 +112,7 @@ func (o *DeleteOption) DeleteWorkspaceWithDashClient(ctx context.Context, worksp WsName: workspaceName, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("WorkspaceServiceClient.DeleteWorkspace", "req", req) res, err := c.WorkspaceServiceClient.DeleteWorkspace(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/workspace/get.go b/internal/cmd/workspace/get.go index f06e6d66..50c27093 100644 --- a/internal/cmd/workspace/get.go +++ b/internal/cmd/workspace/get.go @@ -192,20 +192,13 @@ func (o *GetOption) ApplyFilters(workspaces []*dashv1alpha1.Workspace) []*dashv1 } } - if len(o.WorkspaceNames) > 0 { - ts := make([]*dashv1alpha1.Workspace, 0, len(o.WorkspaceNames)) - WorkspaceLoop: - // Or loop - for _, t := range workspaces { - for _, selected := range o.WorkspaceNames { - if selected == t.GetName() { - ts = append(ts, t) - continue WorkspaceLoop - } - } - } - workspaces = ts + // name filter + for _, wsName := range o.WorkspaceNames { + workspaces = cli.DoFilter(workspaces, func(u *dashv1alpha1.Workspace) []string { + return []string{u.Name} + }, cli.Filter{Operator: cli.OperatorEqual, Value: wsName}) } + return workspaces } diff --git a/internal/cmd/workspace/get_network.go b/internal/cmd/workspace/get_network.go index 92bfb695..430b1cea 100644 --- a/internal/cmd/workspace/get_network.go +++ b/internal/cmd/workspace/get_network.go @@ -96,6 +96,7 @@ func (o *GetNetworkOption) GetWorkspaceWithDashClient(ctx context.Context) (*das UserName: o.UserName, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("WorkspaceServiceClient.GetWorkspace", "req", req) res, err := c.WorkspaceServiceClient.GetWorkspace(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -118,6 +119,7 @@ func (o *GetNetworkOption) OutputTable(w io.Writer, workspace *dashv1alpha1.Work func (o *GetNetworkOption) GetWorkspaceByKubeClient(ctx context.Context) (*dashv1alpha1.Workspace, error) { c := o.KosmoClient + o.Logr.DebugAll().Info("GetWorkspaceByUserName", "workspaceName", o.WorkspaceName, "userName", o.UserName) workspace, err := c.GetWorkspaceByUserName(ctx, o.WorkspaceName, o.UserName) if err != nil { return nil, err diff --git a/internal/cmd/workspace/get_templates.go b/internal/cmd/workspace/get_templates.go index a2b90fdf..57f29d2e 100644 --- a/internal/cmd/workspace/get_templates.go +++ b/internal/cmd/workspace/get_templates.go @@ -141,20 +141,13 @@ func (o *GetTemplatesOption) ApplyFilters(tmpls []*dashv1alpha1.Template) []*das } } - if len(o.TemplateNames) > 0 { - ts := make([]*dashv1alpha1.Template, 0, len(o.TemplateNames)) - WorkspaceLoop: - // Or loop - for _, t := range tmpls { - for _, selected := range o.TemplateNames { - if selected == t.GetName() { - ts = append(ts, t) - continue WorkspaceLoop - } - } - } - tmpls = ts + // name filter + for _, tmplName := range o.TemplateNames { + tmpls = cli.DoFilter(tmpls, func(u *dashv1alpha1.Template) []string { + return []string{u.Name} + }, cli.Filter{Operator: cli.OperatorEqual, Value: tmplName}) } + return tmpls } diff --git a/internal/cmd/workspace/remove_network.go b/internal/cmd/workspace/remove_network.go index 191a52f6..acb33ef5 100644 --- a/internal/cmd/workspace/remove_network.go +++ b/internal/cmd/workspace/remove_network.go @@ -129,6 +129,7 @@ func (o *RemoveNetworkOption) DeleteNetworkRuleWithDashClient(ctx context.Contex UserName: o.UserName, Index: int32(index), } + o.Logr.DebugAll().Info("WorkspaceServiceClient.DeleteNetworkRule", "req", req) res, err := c.WorkspaceServiceClient.DeleteNetworkRule(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/workspace/resume.go b/internal/cmd/workspace/resume.go index 00b21dcc..11860201 100644 --- a/internal/cmd/workspace/resume.go +++ b/internal/cmd/workspace/resume.go @@ -96,6 +96,7 @@ func (o *ResumeOption) ResumeWorkspaceWithDashClient(ctx context.Context, worksp Replicas: ptr.To(int64(1)), } c := o.CosmoDashClient + o.Logr.DebugAll().Info("WorkspaceServiceClient.UpdateWorkspace", "req", req) res, err := c.WorkspaceServiceClient.UpdateWorkspace(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/workspace/suspend.go b/internal/cmd/workspace/suspend.go index d87195a8..0d22c315 100644 --- a/internal/cmd/workspace/suspend.go +++ b/internal/cmd/workspace/suspend.go @@ -96,6 +96,7 @@ func (o *SuspendOption) SuspendWorkspaceWithDashClient(ctx context.Context, work Replicas: ptr.To(int64(0)), } c := o.CosmoDashClient + o.Logr.DebugAll().Info("WorkspaceServiceClient.UpdateWorkspace", "req", req) res, err := c.WorkspaceServiceClient.UpdateWorkspace(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return fmt.Errorf("failed to connect dashboard server: %w", err) diff --git a/internal/cmd/workspace/update.go b/internal/cmd/workspace/update.go index 99ad9564..bcb73c4b 100644 --- a/internal/cmd/workspace/update.go +++ b/internal/cmd/workspace/update.go @@ -142,6 +142,7 @@ func (o *UpdateOption) UpdateWorkspaceWithDashClient(ctx context.Context) (*dash Vars: o.vars, } c := o.CosmoDashClient + o.Logr.DebugAll().Info("WorkspaceServiceClient.UpdateWorkspace", "req", req) res, err := c.WorkspaceServiceClient.UpdateWorkspace(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -152,10 +153,12 @@ func (o *UpdateOption) UpdateWorkspaceWithDashClient(ctx context.Context) (*dash } func (o *UpdateOption) UpdateWorkspaceWithKubeClient(ctx context.Context) (*dashv1alpha1.Workspace, error) { - c := o.KosmoClient - ws, err := c.UpdateWorkspace(ctx, o.UserName, o.WorkspaceName, kosmo.UpdateWorkspaceOpts{ + opts := kosmo.UpdateWorkspaceOpts{ Vars: o.vars, - }) + } + c := o.KosmoClient + o.Logr.DebugAll().Info("UpdateWorkspace", "userName", o.UserName, "workspaceName", o.WorkspaceName, "opts", opts) + ws, err := c.UpdateWorkspace(ctx, o.UserName, o.WorkspaceName, opts) if err != nil { return nil, err } diff --git a/internal/cmd/workspace/upsert_network.go b/internal/cmd/workspace/upsert_network.go index 85336d32..63641dae 100644 --- a/internal/cmd/workspace/upsert_network.go +++ b/internal/cmd/workspace/upsert_network.go @@ -132,6 +132,7 @@ func (o *UpsertNetworkOption) UpsertNetworkRuleWithDashClient(ctx context.Contex NetworkRule: apiconv.C2D_NetworkRule(o.rule), Index: int32(index), } + o.Logr.DebugAll().Info("WorkspaceServiceClient.UpsertNetworkRule", "req", req) res, err := c.WorkspaceServiceClient.UpsertNetworkRule(ctx, cli.NewRequestWithToken(req, o.CliConfig)) if err != nil { return nil, fmt.Errorf("failed to connect dashboard server: %w", err) @@ -149,6 +150,7 @@ func (o *UpsertNetworkOption) UpsertNetworkRuleByKubeClient(ctx context.Context) } index := cosmov1alpha1.GetNetworkRuleIndex(ws.Spec.Network, o.rule) + o.Logr.DebugAll().Info("AddNetworkRule", "workspaceName", o.WorkspaceName, "userName", o.UserName, "rule", o.rule, "index", index) cr, err := c.AddNetworkRule(ctx, o.WorkspaceName, o.UserName, o.rule, index) if err != nil { return nil, err diff --git a/internal/dashboard/__snapshots__/workspace_handler_test.snap b/internal/dashboard/__snapshots__/workspace_handler_test.snap index 1bdc7b9a..046c8d30 100644 --- a/internal/dashboard/__snapshots__/workspace_handler_test.snap +++ b/internal/dashboard/__snapshots__/workspace_handler_test.snap @@ -634,7 +634,10 @@ SnapShot = """ ] }, \"status\": { - \"phase\": \"Pending\" + \"phase\": \"Pending\", + \"last_started_at\": { + \"seconds\": 1234567890 + } } } } diff --git a/internal/dashboard/workspace_handler_test.go b/internal/dashboard/workspace_handler_test.go index 3fcef132..0c0e96c0 100644 --- a/internal/dashboard/workspace_handler_test.go +++ b/internal/dashboard/workspace_handler_test.go @@ -9,6 +9,7 @@ import ( . "github.com/cosmo-workspace/cosmo/pkg/snap" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "google.golang.org/protobuf/types/known/timestamppb" "k8s.io/utils/ptr" cosmov1alpha1 "github.com/cosmo-workspace/cosmo/api/v1alpha1" @@ -232,6 +233,12 @@ var _ = Describe("Dashboard server [Workspace]", func() { //================================================================================== Describe("[UpdateWorkspace]", func() { + updateWorkspaceResponseSnap := func(r *dashv1alpha1.UpdateWorkspaceResponse) *dashv1alpha1.UpdateWorkspaceResponse { + if r.Workspace.Status.LastStartedAt != nil { + r.Workspace.Status.LastStartedAt = timestamppb.New(time.Unix(1234567890, 0)) + } + return r + } run_test := func(loginUser string, req *dashv1alpha1.UpdateWorkspaceRequest) { testUtil.CreateWorkspace("admin-user", "ws1", "template1", map[string]string{}) @@ -240,7 +247,7 @@ var _ = Describe("Dashboard server [Workspace]", func() { ctx := context.Background() res, err := client.UpdateWorkspace(ctx, NewRequestWithSession(req, getSession(loginUser))) if err == nil { - Ω(res.Msg).To(MatchSnapShot()) + Ω(updateWorkspaceResponseSnap(res.Msg)).To(MatchSnapShot()) wsv1Workspace, err := k8sClient.GetWorkspaceByUserName(context.Background(), req.WsName, req.UserName) Expect(err).NotTo(HaveOccurred()) Ω(ObjectSnapshot(wsv1Workspace)).To(MatchSnapShot()) diff --git a/web/dashboard-ui/src/views/organisms/EventDetailDialog.tsx b/web/dashboard-ui/src/views/organisms/EventDetailDialog.tsx index b95bdd91..a5ea739c 100644 --- a/web/dashboard-ui/src/views/organisms/EventDetailDialog.tsx +++ b/web/dashboard-ui/src/views/organisms/EventDetailDialog.tsx @@ -29,7 +29,7 @@ const ClipboardTextField = (props: TextFieldProps) => { const [focused, setFocused] = useState(false); const { enqueueSnackbar } = useSnackbar(); - const onCopy = (text) => { // eslint-disable-line + const onCopy = (text: string) => { copy(text); enqueueSnackbar("Copied!", { variant: "success" }); }; @@ -45,7 +45,7 @@ const ClipboardTextField = (props: TextFieldProps) => { { - onCopy(props.value); + onCopy(String(props.value)); }} > diff --git a/web/dashboard-ui/src/views/organisms/WorkspaceModule.tsx b/web/dashboard-ui/src/views/organisms/WorkspaceModule.tsx index c91198f2..1c2323cf 100644 --- a/web/dashboard-ui/src/views/organisms/WorkspaceModule.tsx +++ b/web/dashboard-ui/src/views/organisms/WorkspaceModule.tsx @@ -164,7 +164,7 @@ const useWorkspace = () => { const ws = getWorkspaceResult.workspace!; const getEventsResult = await userService.getEvents({ - userName: ws.ownerName, + userName: user.name, }); const events = getEventsResult.items.filter((e) => e.regardingWorkspace === ws.name diff --git a/web/dashboard-ui/src/views/pages/WorkspacePage.tsx b/web/dashboard-ui/src/views/pages/WorkspacePage.tsx index 44c9da01..063d24e6 100644 --- a/web/dashboard-ui/src/views/pages/WorkspacePage.tsx +++ b/web/dashboard-ui/src/views/pages/WorkspacePage.tsx @@ -43,7 +43,6 @@ import { MenuItem, Paper, Stack, - styled, Table, TableBody, TableCell, @@ -53,6 +52,7 @@ import { TextField, Tooltip, Typography, + styled, useMediaQuery, useTheme, } from "@mui/material"; @@ -77,10 +77,10 @@ import { WorkspaceStopDialogContext, } from "../organisms/WorkspaceActionDialog"; import { - computeStatus, - useWorkspaceModule, WorkspaceContext, WorkspaceWrapper, + computeStatus, + useWorkspaceModule, } from "../organisms/WorkspaceModule"; import { PageTemplate } from "../templates/PageTemplate"; @@ -656,7 +656,7 @@ const WorkspaceList: React.VFC = () => { {Object.keys(workspaces).filter((wsName) => urlParam.search === "" || Boolean(wsName.match(urlParam.search)) ).map((wsName) => workspaces[wsName]).sort((a, b) => - (a.name < b.name) ? -1 : 1 + a.ownerName !== b.ownerName ? 1 : a.name < b.name ? -1 : 1 ).map((ws) => (