diff --git a/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.model.ts index 96225d0f9..2c5d09e7f 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.model.ts @@ -4,9 +4,12 @@ import { dataSourceMarker, ModelApi, ModelEventPublisher, - ModelProperty + ModelModelPropertyTypeInstance, + ModelProperty, + ModelPropertyType } from '@hypertrace/hyperdash'; import { ModelInject, MODEL_API } from '@hypertrace/hyperdash-angular'; +import { GraphQlRequestOptionsModel } from './request-option/graphql-request-options.model'; import { GraphQlQueryHandler, @@ -32,6 +35,15 @@ export abstract class GraphQlDataSourceModel implements DataSource }) public filters: GraphQlFilter[] = []; + @ModelProperty({ + // tslint:disable-next-line: no-object-literal-type-assertion + type: { + key: ModelPropertyType.TYPE + } as ModelModelPropertyTypeInstance, + key: 'request-options' + }) + public requestOptions?: GraphQlRequestOptionsModel; + @ModelInject(MODEL_API) public api!: ModelApi; public abstract getData(): Observable; @@ -61,7 +73,7 @@ export abstract class GraphQlDataSourceModel implements DataSource this.querySubject.next({ buildRequest: this.convertToBuilder(requestOrBuilder), - requestOptions: requestOptions, + requestOptions: requestOptions ?? this.requestOptions, responseObserver: resultSubject as Observer }); diff --git a/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.module.ts b/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.module.ts index 0df624830..b5150e6df 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.module.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/graphql-data-source.module.ts @@ -7,6 +7,7 @@ import { GraphQlFilterDataSourceModel } from './filter/graphql-filter-data-sourc import { GraphqlIdScopeFilterModel } from './filter/graphql-id-scope-filter.model'; import { GraphQlKeyValueFilterModel } from './filter/graphql-key-value-filter.model'; import { GRAPHQL_DATA_SOURCE_HANDLER_PROVIDERS } from './graphql-handler-configuration'; +import { GraphQlRequestOptionsModel } from './request-option/graphql-request-options.model'; import { SpanDataSourceModel } from './span/span-data-source.model'; import { AttributeSpecificationModel } from './specifiers/attribute-specification.model'; import { CompositeSpecificationModel } from './specifiers/composite-specification.model'; @@ -30,6 +31,7 @@ import { TraceWaterfallDataSourceModel } from './waterfall/trace-waterfall-data- GraphQlFilterDataSourceModel, GraphQlKeyValueFilterModel, GraphqlIdScopeFilterModel, + GraphQlRequestOptionsModel, SpansTableDataSourceModel, TracesTableDataSourceModel, SpanDataSourceModel, diff --git a/projects/observability/src/shared/dashboard/data/graphql/request-option/graphql-request-options.model.ts b/projects/observability/src/shared/dashboard/data/graphql/request-option/graphql-request-options.model.ts new file mode 100644 index 000000000..ee3e89c59 --- /dev/null +++ b/projects/observability/src/shared/dashboard/data/graphql/request-option/graphql-request-options.model.ts @@ -0,0 +1,30 @@ +import { BOOLEAN_PROPERTY, Model, ModelProperty } from '@hypertrace/hyperdash'; + +import { EnumPropertyTypeInstance, ENUM_TYPE } from '@hypertrace/dashboards'; +import { GraphQlRequestCacheability } from '@hypertrace/graphql-client'; + +@Model({ + type: 'request-options' +}) +export class GraphQlRequestOptionsModel { + @ModelProperty({ + key: 'cacheability', + required: false, + // tslint:disable-next-line: no-object-literal-type-assertion + type: { + key: ENUM_TYPE.type, + values: [ + GraphQlRequestCacheability.NotCacheable, + GraphQlRequestCacheability.RefreshCache, + GraphQlRequestCacheability.Cacheable + ] + } as EnumPropertyTypeInstance + }) + public cacheability?: GraphQlRequestCacheability; + + @ModelProperty({ + key: 'isolated', + type: BOOLEAN_PROPERTY.type + }) + public isolated?: boolean; +} diff --git a/projects/observability/src/shared/dashboard/data/graphql/table/table-data-source.model.ts b/projects/observability/src/shared/dashboard/data/graphql/table/table-data-source.model.ts index 521e3ad03..e0f421062 100644 --- a/projects/observability/src/shared/dashboard/data/graphql/table/table-data-source.model.ts +++ b/projects/observability/src/shared/dashboard/data/graphql/table/table-data-source.model.ts @@ -30,8 +30,8 @@ export abstract class TableDataSourceModel extends GraphQlDataSourceModel