File size: 8,528 Bytes
7f8181f
 
fdb3c86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7f8181f
 
 
 
fdb3c86
 
 
 
 
 
 
 
7f8181f
 
fdb3c86
7f8181f
956aaa9
9379d53
956aaa9
 
 
 
 
 
7f8181f
 
 
 
 
956aaa9
 
7f8181f
 
 
 
 
 
 
 
 
fdb3c86
7f8181f
 
fdb3c86
 
 
 
 
 
 
 
7f8181f
fdb3c86
7f8181f
 
 
 
 
 
 
 
 
fdb3c86
 
 
 
 
7f8181f
fdb3c86
7f8181f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956aaa9
7f8181f
 
 
fdb3c86
7f8181f
 
 
 
 
 
 
 
 
 
fdb3c86
7f8181f
 
fdb3c86
 
 
 
 
 
 
7f8181f
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import gradio as gr

js = """
function appJS() {
  document.getElementById("plugin_add_input").addEventListener("click", function() {
    document.getElementById("input-row-2").classList.toggle("active",true);
  });

  document.getElementById("plugin_add_output").addEventListener("click", function() {
    document.getElementById("output-row-2").classList.toggle("active",true);
  });

  document.getElementById("submit-button").addEventListener("click", function() {
    document.getElementById("confirmation-row").classList.toggle("active",true);
  });
}
"""

css = """
.plugin-accordion button span:first-child {
    font-size: 1.25rem !important;
}

.dependent-row {
  display: none !important;
}

.dependent-row.active {
  display: block !important;
}
"""

with gr.Blocks(css=css,js=js) as registry_submit:
  gr.Markdown("# 🔌 Impact Framework Plugin Registry Submission")

  with gr.Accordion("ℹ️ About this Page",open=False,elem_classes=["plugin-accordion"]):

    gr.Markdown("### What does this page do?")
    gr.Markdown("This is a prototype of a form that people could use to submit their plugins to the Impact Framework Plugin Registry")
    gr.Markdown("### Why is this needed?")
    gr.Markdown("Currently plugins are located in various repositories, and it can be difficult to know what they do, where they fit in to the overall pipeline, what inputs they require, what they output, and what data sources they rely on. Having a standardized submission format will add clarity and compatibility amongst plugins, and having a centralized registry repository will make it easier for people to find plugins and assemble coherent manifest pipelines.")

  gr.Markdown("Fill out the form below to submit your plugin to the Impact Framework Registry")

  with gr.Accordion("Plugin Details",open=True,elem_classes=["plugin-accordion"]):
    plugin_name = gr.Textbox(placeholder="What is the name of your plugin?", label="Plugin Name")
    plugin_description = gr.Textbox(placeholder="What does your plugin do?", label="Plugin Description",lines=3)
    plugin_code_url = gr.Textbox(placeholder="https://github.com/[YOUR_ORG]/[YOUR_REPO]", label="Plugin Code", info="Enter the URL where your code repository can be found")
    plugin_website_url = gr.Textbox(placeholder="https://greensoftware.foundation/if/[ID]", label="Plugin Website", info="Enter the URL where more information about your plugin can be found")
    plugin_info = gr.Textbox(placeholder="Add any additional info we should know about your plugin", label="Plugin Info",lines=3)

  with gr.Accordion("Plugin Inputs",open=True,elem_classes=["plugin-accordion"]):
    gr.Markdown("This is where you put the data your plugin requires")

    with gr.Row(elem_classes=["input-row"],variant="panel"):
      plugin_input_1 = gr.Textbox(placeholder="Input name", label="Input Name", info="What is the name of the input?",scale=2)
      plugin_input_1_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Input Type",value="Text",interactive=True,info="What data type does your input expect",scale=2)
      plugin_input_1_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the input expect?",scale=2)
      plugin_1_example = gr.Textbox(placeholder="Your sample value", label="Example", info="Provide an example value for this input",scale=2)
      plugin_input_1_required = gr.Checkbox(label="Required", value=False,scale=1)

    with gr.Row(elem_classes=["input-row","dependent-row"],elem_id="input-row-2", variant="panel"):
      plugin_input_2 = gr.Textbox(placeholder="Input name", label="Input Name", info="What is the name of the input?",scale=2)
      plugin_input_2_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Input Type",value="Text",interactive=True,info="What data type does your input expect",scale=2)
      plugin_input_2_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the input expect?",scale=2)
      plugin_2_example = gr.Textbox(placeholder="Your sample value", label="Example", info="Provide an example value for this input",scale=2)
      plugin_input_2_required = gr.Checkbox(label="Required", value=False,scale=1)


    with gr.Row(elem_classes=["input-row"]):
      plugin_add_input = gr.Button("Add Input",elem_id="plugin_add_input")

  with gr.Accordion("Plugin Outputs",open=True,elem_classes=["plugin-accordion"]):
    gr.Markdown("This is the data your plugin will return")

    with gr.Row(elem_classes=["output-row"],variant="panel"):
      plugin_output_1 = gr.Textbox(placeholder="Output name", label="Output Name", info="What is the name of the output?")
      plugin_output_1_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Output Type",value="Text",interactive=True,info="What data type does your output expect")
      plugin_output_1_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the output expect?")

    with gr.Row(elem_classes=["output-row","dependent-row"],elem_id="output-row-2",variant="panel"):
      plugin_output_2 = gr.Textbox(placeholder="Output name", label="Output Name", info="What is the name of the output?")
      plugin_output_2_type = gr.Dropdown(["Text", "Number", "Boolean"], label="Output Type",value="Text",interactive=True,info="What data type does your output expect")
      plugin_output_2_units = gr.Textbox(placeholder="Watts, Lbs CO2e, etc", label="Units", info="What units of measurement does the output expect?")

    with gr.Row(elem_classes=["output-row"]):
      plugin_add_output = gr.Button("Add Output",elem_id="plugin_add_output")

  with gr.Accordion("Plugin Data",open=True,elem_classes=["plugin-accordion"]):
    gr.Markdown("This is where you put information about your plugin's data sources and assumptions")

    with gr.Row(elem_classes=["data-row"],variant="panel"):
      with gr.Column():
        with gr.Row():
          plugin_data_source_1 = gr.Textbox(placeholder="Data source name", label="Data Source Name", info="What is the name of the data source?")
          plugin_data_source_1_url = gr.Textbox(placeholder="URL", label="Data Source URL", info="What is the URL of the data source?")
        with gr.Row():
          plugin_data_source_1_description = gr.Textbox(placeholder="Description / Citation", label="Data Source Description", info="What does the data source contain, or what is the reference citation?")
    with gr.Row(elem_classes=["data-row"]):
      plugin_add_data_source = gr.Button("Add Data Source")

  with gr.Accordion("Compatible Plugins",open=True,elem_classes=["plugin-accordion"]):

    gr.Markdown("## Input Plugins")
    gr.Markdown("List any known plugins that can provide input into your plugin")

    with gr.Row(elem_classes=["input-row"],variant="panel"):
      with gr.Column():
        plugin_input_plugin_1 = gr.Textbox(placeholder="https://greensoftware.foundation/if/[ID]", label="Plugin Website", info="Enter the impact framework registry URL where the plugin can be found")
      with gr.Column():
        gr.Markdown("Alternatively, search for plugins that are compatible with your required inputs")
        # a button to help users find compatible plugins
        plugin_find_input_plugin = gr.Button("Find Compatible Plugins",interactive=False)
    gr.Button("Add Input Plugin")

    gr.Markdown("## Dependent Plugins")
    gr.Markdown("List any plugins that can utilize the output of your plugin")

    with gr.Row(elem_classes=["output-row"],variant="panel"):
      with gr.Column():
        plugin_output_plugin_1 = gr.Textbox(placeholder="https://greensoftware.foundation/if/[ID]", label="Plugin URL", info="Enter the impact framework registry URL where the plugin can be found")
      with gr.Column():
        gr.Markdown("Alternatively, search for plugins that are compatible with your output")
        plugin_find_output_plugin = gr.Button("Find Compatible Plugins",interactive=False)
    gr.Button("Add Output Plugin")

  gr.Button("Submit Plugin",variant="primary",elem_id="submit-button")

  with gr.Row(elem_classes=["dependent-row"],variant="panel",elem_id="confirmation-row"):
    with gr.Column():
      gr.Markdown("## Submission Confirmed ✔️")
      gr.Markdown("Thank you for submitting your plugin to the Impact Framework Registry. We will review your submission and get back to you soon.")




    #btn = gr.Button("Run")
    #btn.click(fn=update, inputs=inp, outputs=out)

registry_submit.launch()