Repository: temporalio/ui
Pull request #324 (2022-03-15 02:47:12)

Make the "Give Feedback" button open in a new tab

cloudflare-pages[bot]: ## Deploying with &nbsp;<a href="https://pages.dev"><img alt="Cloudflare Pages" src="https://user-images.githubusercontent.com/23264/106598434-9e719e00-654f-11eb-9e59-6167043cfa01.png" width="16"></a> &nbsp;Cloudflare Pages

<table><tr><td><strong>Latest commit:</strong> </td><td>
<code>8298bb4</code>
</td></tr>
<tr><td><strong>Status:</strong></td><td>&nbsp;✅&nbsp; Deploy successful!</td></tr>
<tr><td><strong>Preview URL:</strong></td><td>
<a href='https://17194099.ui-c3x.pages.dev'>https://17194099.ui-c3x.pages.dev</a>
</td></tr>
</table>

[View logs](https://dash.cloudflare.com/?to=/:account/pages/view/temporal-pizza/17194099-0594-4f1b-ab2d-68d79d2d3685)


Patch:
diff --git a/src/lib/components/input-and-result.svelte b/src/lib/components/input-and-result.svelte
index 95f7b72f..ee4c15bf 100644
--- a/src/lib/components/input-and-result.svelte
+++ b/src/lib/components/input-and-result.svelte
@@ -2,7 +2,7 @@
   import { getWorkflowStartedAndCompletedEvents } from '$lib/utilities/get-started-and-completed-events';
   import CodeBlock from './code-block.svelte';
 
-  export let events: HistoryEventWithId[] | PromiseLike<HistoryEventWithId[]>;
+  export let events: HistoryEventWithId[];
 
   $: inputAndResult = getWorkflowStartedAndCompletedEvents(events);
 </script>
diff --git a/src/lib/components/workers-table.svelte b/src/lib/components/workers-table.svelte
index 54f135db..ca20cfda 100644
--- a/src/lib/components/workers-table.svelte
+++ b/src/lib/components/workers-table.svelte
@@ -2,7 +2,7 @@
   <div class="bg-gray-200 flex flex-row p-2">
     <div class="w-3/12 text-left">ID</div>
     <div class="w-3/12 text-left">Last Accessed</div>
-    <div class="w-3/12 text-left">Workflow Table Handler</div>
+    <div class="w-3/12 text-left">Workflow Task Handler</div>
     <div class="w-2/12 text-left">Activity Handler</div>
   </div>
   <slot />
diff --git a/src/lib/utilities/get-started-and-completed-events.ts b/src/lib/utilities/get-started-and-completed-events.ts
index 3043e5f2..a382b167 100644
--- a/src/lib/utilities/get-started-and-completed-events.ts
+++ b/src/lib/utilities/get-started-and-completed-events.ts
@@ -3,11 +3,9 @@ type WorkflowEvents = {
   result: string;
 };
 
-export const getWorkflowStartedAndCompletedEvents = async (
-  events: HistoryEventWithId[] | PromiseLike<HistoryEventWithId[]>,
-): Promise<WorkflowEvents> => {
-  events = await events;
-
+export const getWorkflowStartedAndCompletedEvents = (
+  events: HistoryEventWithId[],
+): WorkflowEvents => {
   let input: string;
   let result: string;
 
@@ -22,14 +20,14 @@ export const getWorkflowStartedAndCompletedEvents = async (
   if (workflowStartedEvent) {
     input = JSON.stringify(
       workflowStartedEvent?.workflowExecutionStartedEventAttributes?.input
-        ?.payloads ?? '',
+        ?.payloads,
     );
   }
 
   if (workflowCompletedEvent) {
     result = JSON.stringify(
       workflowCompletedEvent?.workflowExecutionCompletedEventAttributes?.result
-        ?.payloads ?? '',
+        ?.payloads,
     );
   }
 
diff --git a/src/routes/_header.svelte b/src/routes/_header.svelte
index b4c05ad9..f28c0b52 100644
--- a/src/routes/_header.svelte
+++ b/src/routes/_header.svelte
@@ -11,9 +11,11 @@
 
   import NavigationLink from './_navigation-link.svelte';
   import { page } from '$app/stores';
+
   $: settings = $page.stuff.settings;
 
   let loginUrl = '';
+
   $: {
     const query = (settings.auth.options ?? [])
       .filter((option) => !!$page.url.searchParams.get(option))
@@ -28,16 +30,16 @@
   class="grid grid-rows-1 grid-cols-12 px-10 items-center bg-gray-900 shadow-lg gap-6"
 >
   <div class="flex gap-4 col-span-3">
-    <a href="/" class="block">
+    <a href="/namespaces/{$namespace}" class="block">
       <img src="/logo.svg" alt="Temporal Logo" class="max-h-10" />
     </a>
     <NamespaceSelect />
   </div>
   <div class="flex gap-4 col-span-4">
-    <NavigationLink href={`/namespaces/${$namespace}/workflows`}>
+    <NavigationLink href="/namespaces/{$namespace}/workflows">
       Workflows
     </NavigationLink>
-    <NavigationLink href={`/namespaces/${$namespace}/archival`}>
+    <NavigationLink href="/namespaces/{$namespace}/archival">
       Archival
     </NavigationLink>
   </div>
@@ -48,6 +50,7 @@
     <a
       class="header-button"
       href="https://github.com/temporalio/ui/issues/new/choose"
+      target="_blank"
     >
       Report Bug/Give Feedback
     </a>


Test patch:
diff --git a/src/lib/utilities/get-started-and-completed-events.test.ts b/src/lib/utilities/get-started-and-completed-events.test.ts
new file mode 100644
index 00000000..d78a4ce6
--- /dev/null
+++ b/src/lib/utilities/get-started-and-completed-events.test.ts
@@ -0,0 +1,109 @@
+import { getWorkflowStartedAndCompletedEvents } from './get-started-and-completed-events';
+
+describe(getWorkflowStartedAndCompletedEvents, () => {
+  it('should return null if the input is null', () => {
+    const workflowStartedEvent = {
+      eventId: '1',
+      eventTime: '2022-03-14T17:44:14.996241458Z',
+      eventType: 'WorkflowExecutionStarted',
+      version: '0',
+      taskId: '2097152',
+      workflowExecutionStartedEventAttributes: {
+        workflowType: {
+          name: 'RainbowStatusesWorkflow',
+        },
+        parentWorkflowNamespace: '',
+        parentWorkflowExecution: null,
+        parentInitiatedEventId: '0',
+        taskQueue: {
+          name: 'rainbow-statuses',
+          kind: 'Normal',
+        },
+        input: {
+          payloads: null,
+        },
+        workflowExecutionTimeout: '0s',
+        workflowRunTimeout: '0s',
+        workflowTaskTimeout: '10s',
+        continuedExecutionRunId: '',
+        initiator: 'Unspecified',
+        continuedFailure: null,
+        lastCompletionResult: null,
+        originalExecutionRunId: 'b28e27e5-364f-4807-a8e2-b964f2c8aeb7',
+        identity: '47339@MacBook-Pro@',
+        firstExecutionRunId: 'b28e27e5-364f-4807-a8e2-b964f2c8aeb7',
+        retryPolicy: null,
+        attempt: 1,
+        workflowExecutionExpirationTime: null,
+        cronSchedule: '',
+        firstWorkflowTaskBackoff: '0s',
+        memo: null,
+        searchAttributes: {
+          indexedFields: {
+            CustomBoolField: true,
+            CustomDatetimeField: '2022-03-14T17:44:14.999501Z',
+            CustomDoubleField: 0,
+            CustomIntField: 0,
+            CustomKeywordField: 'rainbow-statuses-61404c',
+            CustomStringField: 'rainbow statuses 61404c Running',
+          },
+        },
+        prevAutoResetPoints: null,
+        header: {
+          fields: {},
+        },
+      },
+      id: '1',
+      attributes: {
+        type: 'workflowExecutionStartedEventAttributes',
+        workflowType: {
+          name: 'RainbowStatusesWorkflow',
+        },
+        parentWorkflowNamespace: '',
+        parentWorkflowExecution: null,
+        parentInitiatedEventId: '0',
+        taskQueue: {
+          name: 'rainbow-statuses',
+          kind: 'Normal',
+        },
+        input: {
+          payloads: [1],
+        },
+        workflowExecutionTimeout: '0s',
+        workflowRunTimeout: '0s',
+        workflowTaskTimeout: '10s',
+        continuedExecutionRunId: '',
+        initiator: 'Unspecified',
+        continuedFailure: null,
+        lastCompletionResult: null,
+        originalExecutionRunId: 'b28e27e5-364f-4807-a8e2-b964f2c8aeb7',
+        identity: '47339@MacBook-Pro@',
+        firstExecutionRunId: 'b28e27e5-364f-4807-a8e2-b964f2c8aeb7',
+        retryPolicy: null,
+        attempt: 1,
+        workflowExecutionExpirationTime: null,
+        cronSchedule: '',
+        firstWorkflowTaskBackoff: '0s',
+        memo: null,
+        searchAttributes: {
+          indexedFields: {
+            CustomBoolField: true,
+            CustomDatetimeField: '2022-03-14T17:44:14.999501Z',
+            CustomDoubleField: 0,
+            CustomIntField: 0,
+            CustomKeywordField: 'rainbow-statuses-61404c',
+            CustomStringField: 'rainbow statuses 61404c Running',
+          },
+        },
+        prevAutoResetPoints: null,
+        header: {
+          fields: {},
+        },
+      },
+    };
+
+    expect(
+      getWorkflowStartedAndCompletedEvents([workflowStartedEvent]).input,
+    ).toBe('null');
+  });
+});