Skip to content

Commit

Permalink
Merge pull request #11197 from influxdata/feat/add-protoboard-creatio…
Browse files Browse the repository at this point in the history
…n-to-onboarding

Add protos state in redux and create protos API infrastructure
  • Loading branch information
ebb-tide committed Jan 17, 2019
2 parents 1a60b18 + 95e8088 commit 15547ed
Show file tree
Hide file tree
Showing 9 changed files with 479 additions and 2 deletions.
88 changes: 87 additions & 1 deletion http/cur_swagger.yml
Expand Up @@ -43,6 +43,59 @@ paths:
application/json:
schema:
$ref: "#/components/schemas/Routes"
/protos:
get:
tags:
- Protos
summary: List of available protos (templates of tasks/dashboards/etc)
parameters:
- $ref: '#/components/parameters/TraceSpan'
responses:
'200':
description: List of protos
content:
application/json:
schema:
$ref: "#/components/schemas/Protos"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/protos/{protoID}/dashboards:
post:
tags:
- Protos
summary: Create instance of a proto dashboard
parameters:
- $ref: '#/components/parameters/TraceSpan'
- in: path
name: protoID
schema:
type: string
required: true
description: ID of proto
requestBody:
description: organization that the dashboard will be created as
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CreateProtoResourcesRequest"
responses:
'201':
description: List of dashboards that was created
content:
application/json:
schema:
$ref: "#/components/schemas/Dashboards"
default:
description: unexpected error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/setup:
get:
tags:
Expand Down Expand Up @@ -6102,4 +6155,37 @@ components:
type: object
description: Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value.
example: {"color": "#ffb3b3", "description": "this is a description"}

CreateProtoResourcesRequest:
properties:
orgID:
type: string
Proto:
properties:
links:
readOnly: true
type: object
properties:
dashboard:
type: string
format: uri
id:
readOnly: true
type: string
name:
readOnly: true
type: string
description: user-facing name of the proto
dashboards:
type: array
items:
$ref: "#/components/schemas/Dashboard"
views:
type: object
additionalProperties:
$ref: "#/components/schemas/View"
Protos:
properties:
protos:
type: array
items:
$ref: "#/components/schemas/Proto"
273 changes: 273 additions & 0 deletions ui/src/api/api.ts
Expand Up @@ -594,6 +594,20 @@ export interface CreateCell {
usingView?: string;
}

/**
*
* @export
* @interface CreateProtoResourcesRequest
*/
export interface CreateProtoResourcesRequest {
/**
*
* @type {string}
* @memberof CreateProtoResourcesRequest
*/
orgID?: string;
}

/**
*
* @export
Expand Down Expand Up @@ -1990,6 +2004,72 @@ export namespace PermissionResource {
}
}

/**
*
* @export
* @interface Proto
*/
export interface Proto {
/**
*
* @type {ProtoLinks}
* @memberof Proto
*/
links?: ProtoLinks;
/**
*
* @type {string}
* @memberof Proto
*/
id?: string;
/**
* user-facing name of the proto
* @type {string}
* @memberof Proto
*/
name?: string;
/**
*
* @type {Array<Dashboard>}
* @memberof Proto
*/
dashboards?: Array<Dashboard>;
/**
*
* @type {{ [key: string]: View; }}
* @memberof Proto
*/
views?: { [key: string]: View; };
}

/**
*
* @export
* @interface ProtoLinks
*/
export interface ProtoLinks {
/**
*
* @type {string}
* @memberof ProtoLinks
*/
dashboard?: string;
}

/**
*
* @export
* @interface Protos
*/
export interface Protos {
/**
*
* @type {Array<Proto>}
* @memberof Protos
*/
protos?: Array<Proto>;
}

/**
* query influx with specified return formatting. The spec and query fields are mutually exclusive.
* @export
Expand Down Expand Up @@ -10286,6 +10366,199 @@ export class OrganizationsApi extends BaseAPI {

}

/**
* ProtosApi - axios parameter creator
* @export
*/
export const ProtosApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary List of available protos (templates of tasks/dashboards/etc)
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protosGet(zapTraceSpan?: string, options: any = {}): RequestArgs {
const localVarPath = `/protos`;
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options);
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (zapTraceSpan !== undefined && zapTraceSpan !== null) {
localVarHeaderParameter['Zap-Trace-Span'] = String(zapTraceSpan);
}

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Create instance of a proto dashboard
* @param {string} protoID ID of proto
* @param {CreateProtoResourcesRequest} createProtoResourcesRequest organization that the dashboard will be created as
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protosProtoIDDashboardsPost(protoID: string, createProtoResourcesRequest: CreateProtoResourcesRequest, zapTraceSpan?: string, options: any = {}): RequestArgs {
// verify required parameter 'protoID' is not null or undefined
if (protoID === null || protoID === undefined) {
throw new RequiredError('protoID','Required parameter protoID was null or undefined when calling protosProtoIDDashboardsPost.');
}
// verify required parameter 'createProtoResourcesRequest' is not null or undefined
if (createProtoResourcesRequest === null || createProtoResourcesRequest === undefined) {
throw new RequiredError('createProtoResourcesRequest','Required parameter createProtoResourcesRequest was null or undefined when calling protosProtoIDDashboardsPost.');
}
const localVarPath = `/protos/{protoID}/dashboards`
.replace(`{${"protoID"}}`, encodeURIComponent(String(protoID)));
const localVarUrlObj = url.parse(localVarPath, true);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options);
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;

if (zapTraceSpan !== undefined && zapTraceSpan !== null) {
localVarHeaderParameter['Zap-Trace-Span'] = String(zapTraceSpan);
}

localVarHeaderParameter['Content-Type'] = 'application/json';

localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
// fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
delete localVarUrlObj.search;
localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);
const needsSerialization = (<any>"CreateProtoResourcesRequest" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
localVarRequestOptions.data = needsSerialization ? JSON.stringify(createProtoResourcesRequest || {}) : (createProtoResourcesRequest || "");

return {
url: url.format(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};

/**
* ProtosApi - functional programming interface
* @export
*/
export const ProtosApiFp = function(configuration?: Configuration) {
return {
/**
*
* @summary List of available protos (templates of tasks/dashboards/etc)
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protosGet(zapTraceSpan?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Protos> {
const localVarAxiosArgs = ProtosApiAxiosParamCreator(configuration).protosGet(zapTraceSpan, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url})
return axios.request(axiosRequestArgs);
};
},
/**
*
* @summary Create instance of a proto dashboard
* @param {string} protoID ID of proto
* @param {CreateProtoResourcesRequest} createProtoResourcesRequest organization that the dashboard will be created as
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protosProtoIDDashboardsPost(protoID: string, createProtoResourcesRequest: CreateProtoResourcesRequest, zapTraceSpan?: string, options?: any): (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Dashboards> {
const localVarAxiosArgs = ProtosApiAxiosParamCreator(configuration).protosProtoIDDashboardsPost(protoID, createProtoResourcesRequest, zapTraceSpan, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url})
return axios.request(axiosRequestArgs);
};
},
}
};

/**
* ProtosApi - factory interface
* @export
*/
export const ProtosApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
*
* @summary List of available protos (templates of tasks/dashboards/etc)
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protosGet(zapTraceSpan?: string, options?: any) {
return ProtosApiFp(configuration).protosGet(zapTraceSpan, options)(axios, basePath);
},
/**
*
* @summary Create instance of a proto dashboard
* @param {string} protoID ID of proto
* @param {CreateProtoResourcesRequest} createProtoResourcesRequest organization that the dashboard will be created as
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
protosProtoIDDashboardsPost(protoID: string, createProtoResourcesRequest: CreateProtoResourcesRequest, zapTraceSpan?: string, options?: any) {
return ProtosApiFp(configuration).protosProtoIDDashboardsPost(protoID, createProtoResourcesRequest, zapTraceSpan, options)(axios, basePath);
},
};
};

/**
* ProtosApi - object-oriented interface
* @export
* @class ProtosApi
* @extends {BaseAPI}
*/
export class ProtosApi extends BaseAPI {
/**
*
* @summary List of available protos (templates of tasks/dashboards/etc)
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ProtosApi
*/
public protosGet(zapTraceSpan?: string, options?: any) {
return ProtosApiFp(this.configuration).protosGet(zapTraceSpan, options)(this.axios, this.basePath);
}

/**
*
* @summary Create instance of a proto dashboard
* @param {string} protoID ID of proto
* @param {CreateProtoResourcesRequest} createProtoResourcesRequest organization that the dashboard will be created as
* @param {string} [zapTraceSpan] OpenTracing span context
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ProtosApi
*/
public protosProtoIDDashboardsPost(protoID: string, createProtoResourcesRequest: CreateProtoResourcesRequest, zapTraceSpan?: string, options?: any) {
return ProtosApiFp(this.configuration).protosProtoIDDashboardsPost(protoID, createProtoResourcesRequest, zapTraceSpan, options)(this.axios, this.basePath);
}

}

/**
* QueryApi - axios parameter creator
* @export
Expand Down

0 comments on commit 15547ed

Please sign in to comment.