Skip to content

Commit

Permalink
use workspace title
Browse files Browse the repository at this point in the history
  • Loading branch information
Mavrin committed Jun 7, 2024
1 parent a0734a1 commit 5cbfdbf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getCommandApiUrl = (host: string) => {
export async function getMe(): Promise<User> {
const me = await apiCall<{
email: string;
workspaces: Array<{ name: string }>;
workspaces: Array<{ name: string; title: string }>;
}>(meUrl, { method: "GET" });
return {
...me,
Expand Down
5 changes: 4 additions & 1 deletion src/api/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ const createEntityCommands = ({
throw Error(`Type ${type["fibery/name"]} doesn't have title field`);
}
const urlField = type["fibery/fields"].find((field) => {
return field["fibery/meta"]["ui/type"] === "url";
return (
field["fibery/meta"]["ui/type"] === "url" ||
field["fibery/type"] === "fibery/url"
);
});
return [
{
Expand Down
9 changes: 2 additions & 7 deletions src/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ function getTypes(schema: Schema) {
return typesByGroup;
}

function getWorkspaceName(host: string) {
const [name] = host.split(".");
return name;
}

function TypesSelect({
onChange,
value,
Expand Down Expand Up @@ -325,9 +320,9 @@ function Form({
id="workspace"
>
<option value="">Select Workspace</option>
{me.workspaces.map(({ name }) => (
{me.workspaces.map(({ name, title }) => (
<option key={name} value={name}>
{getWorkspaceName(name)}
{title}
</option>
))}
</select>
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export type User = {
email: string;
workspaces: Array<{ name: string }>;
workspaces: Array<{ name: string; title: string }>;
lastUsedWorkspace?: string;
lastUsedType?: string;
lastUsedTypeName?: string;
Expand Down

0 comments on commit 5cbfdbf

Please sign in to comment.