Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate reporter #1558

Merged
merged 31 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
fb79f41
Integrate reporter
peraltafederico Aug 19, 2024
de6c0e5
Merge remote-tracking branch 'origin/main' into feat/reporter
peraltafederico Aug 20, 2024
db6b80e
Integrate platform
peraltafederico Aug 20, 2024
42fd713
Integrate
peraltafederico Aug 21, 2024
72d7b19
Fix test
peraltafederico Aug 21, 2024
65c2808
Merge remote-tracking branch 'origin/main' into feat/reporter
peraltafederico Aug 21, 2024
ed04d5a
Fix test
peraltafederico Aug 21, 2024
7883b99
.
peraltafederico Aug 21, 2024
d43266c
Add notify
peraltafederico Aug 21, 2024
eb05a2d
Integrate archive
peraltafederico Aug 21, 2024
6c3d062
Clean up tests
peraltafederico Aug 21, 2024
4903bf0
Clean up
peraltafederico Aug 21, 2024
781da43
Fix comment
peraltafederico Aug 21, 2024
64d8e20
Restore sharing
peraltafederico Aug 22, 2024
0c2c179
Add VS metadata
peraltafederico Aug 22, 2024
9afa8ab
Clean up
peraltafederico Aug 22, 2024
0136887
Normalize
peraltafederico Aug 22, 2024
6b27ebe
Send extension message
peraltafederico Aug 28, 2024
ff0abfd
Merge remote-tracking branch 'origin/main' into feat/reporter
peraltafederico Aug 28, 2024
690cce4
Parse data in client side
peraltafederico Aug 28, 2024
b56b841
Integrate CreateExtensionCellOutput
peraltafederico Aug 29, 2024
27c710f
Add experiment flag
peraltafederico Aug 30, 2024
bd14094
Add experiment flag
peraltafederico Aug 30, 2024
99e3c24
Add comments
peraltafederico Aug 30, 2024
743b72a
Clean up
peraltafederico Aug 30, 2024
cb2c13f
Use #experiments
peraltafederico Sep 3, 2024
45f0f66
Merge remote-tracking branch 'origin/main' into feat/reporter
peraltafederico Sep 3, 2024
ffb9ce2
Update protos
peraltafederico Sep 4, 2024
526324e
Fix test
peraltafederico Sep 4, 2024
22a19a2
Pass update
peraltafederico Sep 4, 2024
f3bb279
Merge remote-tracking branch 'origin/main' into feat/reporter
peraltafederico Sep 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@
"default": false,
"markdownDescription": "If set to `true`, the extension will display an error message if an unsupported shell is detected."
},
"runme.experiments.reporter": {
"type": "boolean",
"scope": "window",
"default": false,
"markdownDescription": "If set to `true`, the extension will use the new reporter API to create outputs."
},
"runme.checkout.projectDir": {
"type": "string",
"scope": "machine",
Expand Down
24 changes: 15 additions & 9 deletions src/client/components/terminal/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ import { onClientMessage, postClientMessage } from '../../../utils/messaging'
import { stripANSI } from '../../../utils/ansi'
import { APIMethod } from '../../../types'
import type { TerminalConfiguration } from '../../../utils/configuration'

import '../closeCellButton'
import '../copyButton'
import './share'
import './gistCell'
import './open'
import {
CreateCellExecutionMutation,
CreateExtensionCellOutputMutation,
UpdateCellOutputMutation,
} from '../../../extension/__generated-platform__/graphql'

interface IWindowSize {
width: number
Expand Down Expand Up @@ -480,14 +484,16 @@ export class TerminalView extends LitElement {
return
}

const { data } = e.output.data
const data = (e.output.data?.data || {}) as CreateExtensionCellOutputMutation &
CreateCellExecutionMutation &
UpdateCellOutputMutation
const { escalationButton: escalationButtonEnabled } = e.output
if (data.createCellExecution) {
const {
createCellExecution: { id, exitCode, htmlUrl },
} = data
// TODO: Remove createCellExecution once the transition is complete and tested enough.
if (data.createExtensionCellOutput || data.createCellExecution) {
const objData = data.createCellExecution || data.createExtensionCellOutput || {}
const { exitCode, id, htmlUrl } = objData
this.cloudId = id
this.shareUrl = htmlUrl
this.shareUrl = htmlUrl || ''
this.shareText = this.getSecondaryButtonLabel(exitCode, escalationButtonEnabled)
this.isShareReady = true
// Dispatch tangle update event
Expand All @@ -498,9 +504,9 @@ export class TerminalView extends LitElement {
},
})
}
if (data.updateCellExecution) {
if (data.updateCellOutput) {
const {
updateCellExecution: { exitCode },
updateCellOutput: { exitCode },
} = data
this.isUpdatedReady = true
this.shareText = this.getSecondaryButtonLabel(exitCode, escalationButtonEnabled)
Expand Down
17 changes: 11 additions & 6 deletions src/extension/__generated-platform__/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/
* Therefore it is highly recommended to use the babel or swc plugin for production.
*/
const documents = {
"mutation ArchiveCellExecution($archiveCellExecutionId: String!) {\n archiveCellExecution(id: $archiveCellExecutionId) {\n id\n }\n}": types.ArchiveCellExecutionDocument,
"mutation ArchiveCellOutput($id: String!) {\n archiveCellOutput(id: $id) {\n id\n }\n}": types.ArchiveCellOutputDocument,
"mutation CreateCellExecution($input: CreateCellExecutionInput!) {\n createCellExecution(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.CreateCellExecutionDocument,
"mutation UnArchiveCellExecution($unArchiveCellExecutionId: String!) {\n unArchiveCellExecution(id: $unArchiveCellExecutionId) {\n id\n }\n}": types.UnArchiveCellExecutionDocument,
"mutation UpdateCellExecution($id: String!, $input: UpdateCellExecutionInput!) {\n updateCellExecution(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.UpdateCellExecutionDocument,
"mutation CreateExtensionCellOutput($input: ReporterInput!) {\n createExtensionCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.CreateExtensionCellOutputDocument,
"mutation UnArchiveCellOutput($id: String!) {\n unArchiveCellOutput(id: $id) {\n id\n }\n}": types.UnArchiveCellOutputDocument,
"mutation UpdateCellOutput($id: String!, $input: UpdateCellOutputInput!) {\n updateCellOutput(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}": types.UpdateCellOutputDocument,
};

/**
Expand All @@ -36,19 +37,23 @@ export function graphql(source: string): unknown;
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation ArchiveCellExecution($archiveCellExecutionId: String!) {\n archiveCellExecution(id: $archiveCellExecutionId) {\n id\n }\n}"): (typeof documents)["mutation ArchiveCellExecution($archiveCellExecutionId: String!) {\n archiveCellExecution(id: $archiveCellExecutionId) {\n id\n }\n}"];
export function graphql(source: "mutation ArchiveCellOutput($id: String!) {\n archiveCellOutput(id: $id) {\n id\n }\n}"): (typeof documents)["mutation ArchiveCellOutput($id: String!) {\n archiveCellOutput(id: $id) {\n id\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation CreateCellExecution($input: CreateCellExecutionInput!) {\n createCellExecution(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"): (typeof documents)["mutation CreateCellExecution($input: CreateCellExecutionInput!) {\n createCellExecution(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation UnArchiveCellExecution($unArchiveCellExecutionId: String!) {\n unArchiveCellExecution(id: $unArchiveCellExecutionId) {\n id\n }\n}"): (typeof documents)["mutation UnArchiveCellExecution($unArchiveCellExecutionId: String!) {\n unArchiveCellExecution(id: $unArchiveCellExecutionId) {\n id\n }\n}"];
export function graphql(source: "mutation CreateExtensionCellOutput($input: ReporterInput!) {\n createExtensionCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"): (typeof documents)["mutation CreateExtensionCellOutput($input: ReporterInput!) {\n createExtensionCellOutput(input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation UpdateCellExecution($id: String!, $input: UpdateCellExecutionInput!) {\n updateCellExecution(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"): (typeof documents)["mutation UpdateCellExecution($id: String!, $input: UpdateCellExecutionInput!) {\n updateCellExecution(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"];
export function graphql(source: "mutation UnArchiveCellOutput($id: String!) {\n unArchiveCellOutput(id: $id) {\n id\n }\n}"): (typeof documents)["mutation UnArchiveCellOutput($id: String!) {\n unArchiveCellOutput(id: $id) {\n id\n }\n}"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "mutation UpdateCellOutput($id: String!, $input: UpdateCellOutputInput!) {\n updateCellOutput(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"): (typeof documents)["mutation UpdateCellOutput($id: String!, $input: UpdateCellOutputInput!) {\n updateCellOutput(id: $id, input: $input) {\n id\n htmlUrl\n exitCode\n isSlackReady\n }\n}"];

export function graphql(source: string) {
return (documents as any)[source] ?? {};
Expand Down
Loading
Loading