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

added documentation for datasource v1 and v2 #71

Merged
merged 26 commits into from
Apr 28, 2023

Conversation

krgrsebastian
Copy link
Contributor

feat #52

@krgrsebastian krgrsebastian requested review from DaruZero and a team March 10, 2023 09:26
@krgrsebastian krgrsebastian self-assigned this Mar 10, 2023
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 10, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: f1c42e9
Status: ✅  Deploy successful!
Preview URL: https://574e6649.umh-docs-umh-app.pages.dev
Branch Preview URL: https://feat-52-grafanaplugin-dataso.umh-docs-umh-app.pages.dev

View logs

Copy link
Contributor

@DaruZero DaruZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the images on the preview

@DaruZero
Copy link
Contributor

Create an archetype for the grafana-plugins:

  • create a new file archetypes/grafana-plugins.md with the following content:

    ---
    title: "{{ replace .Name "-" " " | title }}"
    content_type: grafana-plugin
    description: |
        The technical documentation of the {{ .Name }} plugin,
        which
    weight: 0
    ---
    
    <!-- overview -->
    
    <!-- body -->
    
    <!-- Add the prerequisites section only if needed -->
    ## {{% heading "prerequisites" %}}
    
    ## {{% heading "howitworks" %}}
    
    ## {{% heading "configuration" %}}
  • use the following command to create a new page using that archetype:

    hugo new -k grafana-plugins docs/architecture/microservices/grafana-plugins/umh-datasource-v2.md
  • migrate the articles to the new format. put what you wrote in the "Get started" section under the overview comment

Copy link
Member

@JeremyTheocharis JeremyTheocharis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis would also the best place to actual explain the capabilities of the datasource, so to go through each slider, etc. and explain what it does. What does Time Bucket do? What does configuration do? etc.

Copy link
Contributor

@DaruZero DaruZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still can't see the pictures from the CloudFlare preview

@krgrsebastian krgrsebastian requested a review from DaruZero March 13, 2023 12:13
Copy link
Contributor

@DaruZero DaruZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@JeremyTheocharis
Copy link
Member

Check out also this code here:

  // Aggregates configuration
    tagAggregatesOptions = [
        {label: 'Average', value: 'avg', description: 'The average value of all values in the time bucket'},
        {label: 'Minimum', value: 'min', description: 'The minimum value of all values in the time bucket'},
        {label: 'Maximum', value: 'max', description: 'The maximum value of all values in the time bucket'},
        {label: 'Sum', value: 'sum', description: 'The sum of all values in the time bucket'},
        {label: 'Count', value: 'count', description: 'The number of values in the time bucket'},
    ];
    defaultConfigurationAggregates: SelectableValue = this.tagAggregatesOptions[0];
    selectedConfigurationAggregates: SelectableValue[] = [];

    // time bucket configuration
    tagTimeBucketUnitOptions = [
        {label: 'Minute', value: 'm'},
        {label: 'Hour', value: 'h'},
        {label: 'Day', value: 'd'},
        {label: 'Week', value: 'w'},
        {label: 'Month', value: 'M'},
        {label: 'Year', value: 'y'},
    ];
    timeBucketEnabled = true;
    defaultTimeBucketSize = '1';
    selectedTimeBucketSize: string = this.defaultTimeBucketSize;
    defaultTimeBucketUnit: SelectableValue = this.tagTimeBucketUnitOptions[0];
    selectedTimeBucketUnit: SelectableValue = this.tagTimeBucketUnitOptions[0];
    defaultConfigurationTimeBucket: string = this.defaultTimeBucketSize + this.defaultTimeBucketUnit.value;
    selectedConfigurationTimeBucket: string = this.defaultConfigurationTimeBucket;

    // Gapfilling configuration
    tagGapfillingOptions = [
        {label: 'Show as NULL (default)', value: 'null', description: 'Missing data will show as NULL'},
        {
            label: 'Interpolate',
            value: 'interpolation',
            description: 'The interpolate function does linear interpolation for missing values.',
        },
        {
            label: 'LOCF',
            value: 'locf',
            description:
                'The LOCF (last observation carried forward) function allows you to carry the last seen value in an aggregation group forward. ',
        },
    ];
    defaultConfigurationGapfilling: SelectableValue = this.tagGapfillingOptions[0];
    selectedConfigurationGapfilling: SelectableValue = this.defaultConfigurationGapfilling;
    ```

@JeremyTheocharis
Copy link
Member

And check out this:

                                    <InlineField
                                        label="Select new value"
                                        labelWidth={23}
                                        tooltip={'Select an automatically calculated KPI or a tag for the selected work cell'}
                                    >
                                        <Cascader
                                            separator=" / "
                                            options={this.valueStructure}
                                            onSelect={this.onValueChange}
                                            displayAllSelectedLevels={false}
                                            initialValue={this.selectedValue}
                                            width={100}
                                        />
                                    </InlineField>
                                </FieldSet>
                                <FieldSet label="Options" hidden={!this.isCurrentSelectedValueAvailability()}>
                                    <InlineField label="Include running processes" labelWidth={'auto'}
                                                 tooltip={'Include running processes'}>
                                        <InlineSwitch
                                            value={this.selectedConfigurationIncludeRunningProcesses}
                                            onClick={this.onConfigurationIncludeRunningProcessesChange}
                                        />
                                    </InlineField>
                                    <InlineField label="Keep states" labelWidth={'auto'} tooltip={'Keep states'}>
                                        <InlineSwitch value={this.selectedConfigurationKeepStates}
                                                      onClick={this.onConfigurationKeepStatesChange}/>
                                    </InlineField>
                                </FieldSet>
                                <FieldSet label="Options" hidden={!this.isCurrentSelectedValueACustomTag()}>
                                    <InlineFieldRow>
                                        <InlineField
                                            label="Time bucket"
                                            labelWidth={'auto'}
                                            tooltip="Enable if you want to group data in a time bucket"
                                        >
                                            <InlineSwitch
                                                label="Enable"
                                                showLabel={true}
                                                value={this.timeBucketEnabled}
                                                onClick={this.onTimeBucketEnabledChange}
                                            />
                                        </InlineField>
                                        <InlineField
                                            label={'Size'}
                                            invalid={!this.isStringValidNumber(this.selectedTimeBucketSize)}
                                            error={'This input is required and must be a valid number'}
                                            disabled={!this.timeBucketEnabled}
                                        >
                                            <Input value={this.selectedTimeBucketSize}
                                                   onChange={this.onTimeBucketSizeChange}
                                                   width={20}/>
                                        </InlineField>
                                        <InlineField label={'Unit'} disabled={!this.timeBucketEnabled}>
                                            <Select
                                                options={this.tagTimeBucketUnitOptions}
                                                width={20}
                                                defaultValue={this.defaultTimeBucketUnit.value}
                                                value={this.selectedTimeBucketUnit}
                                                onChange={this.onTimeBucketUnitChange}
                                            />
                                        </InlineField>
                                    </InlineFieldRow>
                                    <FieldSet hidden={!this.timeBucketEnabled}>
                                        <InlineField label="Aggregates" labelWidth={'auto'}
                                                     tooltip={'Common statistical aggregates'}>
                                            <MultiSelect
                                                options={this.tagAggregatesOptions}
                                                width={30}
                                                defaultValue={this.defaultConfigurationAggregates}
                                                value={this.selectedConfigurationAggregates}
                                                onChange={this.onConfigurationAggregatesChange}
                                            />
                                        </InlineField>
                                        <InlineField
                                            label="Handling missing values"
                                            labelWidth={35}
                                            tooltip={'How missing data should be filled. For more information, please visit our documentation.'}
                                        >
                                            <Select
                                                options={this.tagGapfillingOptions}
                                                width={30}
                                                defaultValue={this.tagGapfillingOptions[0]}
                                                value={this.selectedConfigurationGapfilling}
                                                onChange={this.onConfigurationGapfillingChange}
                                            />
                                        </InlineField>
                                        <InlineField
                                            label="Include last datapoint before time interval"
                                            labelWidth={35}
                                            tooltip={'Include last datapoint before time interval'}
                                        >
                                            <InlineSwitch
                                                value={this.selectedConfigurationIncludeLastDatapoint}
                                                onClick={this.onConfigurationIncludeLastDatapointChange}
                                            />
                                        </InlineField>
                                        <InlineField
                                            label="Include next datapoint after time interval"
                                            labelWidth={35}
                                            tooltip={'Include next datapoint after time interval'}
                                        >
                                            <InlineSwitch
                                                value={this.selectedConfigurationIncludeNextDatapoint}
                                                onClick={this.onConfigurationIncludeNextDatapointChange}
                                            />
                                        </InlineField>
                                    </FieldSet>
                                </FieldSet>
                                <FieldSet label="Options" hidden={!this.isCurrentSelectedValueAStandardTag()}>
                                    <InlineField
                                        label="Keep state integer"
                                        labelWidth={'auto'}
                                        tooltip={'Keep state as integer instead of converting them to their string value'}
                                        hidden={!this.isStandardTagState()}
                                    >
                                        <InlineSwitch value={this.selectedConfigurationKeepStates}
                                                      onClick={this.onConfigurationKeepStatesChange}/>
                                    </InlineField>
                                </FieldSet>
                                ```

@DaruZero
Copy link
Contributor

Since the query options are not available for every value to query, it should be explicitly indicated which options are available for which values

@CLAassistant
Copy link

CLAassistant commented Mar 22, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@DaruZero DaruZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the correct formatting style.

  • Each line should not be longer than 80 characters. You can set a vertical line in your text editor to help you with that. Depending on the editor you use, the setting might be called ruler, right margin, or column
  • Use a markdown linter. For example, in VS code there is an extension called markdownlint that will show you common style errors, like not having a blank line before and after a code block ``` ... ```

Lastly, remember to squash the commits before merging. Here more info about that. Ask me for help if you have doubts

@krgrsebastian krgrsebastian requested a review from DaruZero April 28, 2023 08:32
Copy link
Contributor

@DaruZero DaruZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the correct formatting style.

  • Each line should not be longer than 80 characters. You can set a vertical line in your text editor to help you with that. Depending on the editor you use, the setting might be called ruler, right margin, or column
  • Use a markdown linter. For example, in VS code there is an extension called markdownlint that will show you common style errors, like not having a blank line before and after a code block ``` ... ```

Lastly, remember to squash the commits before merging. Here more info about that. Ask me for help if you have doubts

@krgrsebastian krgrsebastian requested a review from DaruZero April 28, 2023 09:17
Copy link
Contributor

@DaruZero DaruZero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to solve the merge conflicts and to squash the commits afterwards (we follow the conventional commits style)
Other than that, LGTM

…_datasource_v2

# Conflicts:
#	umh.docs.umh.app/content/en/docs/architecture/microservices/grafana-plugins/umh-datasource-v2.md
#	umh.docs.umh.app/content/en/docs/architecture/microservices/grafana-plugins/umh-datasource.md
@krgrsebastian krgrsebastian enabled auto-merge (squash) April 28, 2023 11:04
@krgrsebastian krgrsebastian merged commit c95ebb9 into main Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants