Skip to content

Commit

Permalink
Integrate reporter (#1558)
Browse files Browse the repository at this point in the history
* Integrate reporter

* Integrate platform

* Integrate

* Fix test

* Fix test

* .

* Add notify

* Integrate archive

* Clean up tests

* Clean up

* Fix comment

* Restore sharing

* Add VS metadata

* Clean up

* Normalize

* Send extension message

* Parse data in client side

* Integrate CreateExtensionCellOutput

* Add experiment flag

* Add experiment flag

* Add comments

* Clean up

* Use #experiments

* Update protos

* Fix test

* Pass update
  • Loading branch information
peraltafederico authored Sep 4, 2024
1 parent dda7d8a commit c9d0be3
Show file tree
Hide file tree
Showing 21 changed files with 619 additions and 231 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion 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 Expand Up @@ -1155,7 +1161,7 @@
"@buf/grpc_grpc.community_timostamm-protobuf-ts": "^2.9.4-20240809200651-8507e5a24938.4",
"@buf/jlewi_foyle.bufbuild_es": "^1.10.0-00000000000000-d14934cb2733.1",
"@buf/jlewi_foyle.connectrpc_es": "^1.4.0-00000000000000-d14934cb2733.3",
"@buf/stateful_runme.community_timostamm-protobuf-ts": "^2.9.4-20240826183545-20a8540bddaf.4",
"@buf/stateful_runme.community_timostamm-protobuf-ts": "^2.9.4-20240903224300-611a892c2067.4",
"@connectrpc/connect": "^1.4.0",
"@connectrpc/connect-node": "^1.1.2",
"@google-cloud/compute": "^4.1.0",
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

0 comments on commit c9d0be3

Please sign in to comment.