Skip to content

Commit 09dec15

Browse files
Merge pull request #7804 from microsoft/wangmi/endgame-202308
fix issues in endgame test.
2 parents cb5726c + 680fcee commit 09dec15

File tree

27 files changed

+206
-398
lines changed

27 files changed

+206
-398
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-applicationinsights/src/main/java/com/microsoft/azure/toolkit/intellij/applicationinsights/connection/ApplicationInsightsResourcePanel.form

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.microsoft.azure.toolkit.intellij.applicationinsights.connection.ApplicationInsightsResourcePanel">
3-
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="27dc6" binding="pnlRoot" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
66
<xy x="20" y="20" width="500" height="118"/>
@@ -22,7 +22,7 @@
2222
</component>
2323
<vspacer id="e6a8c">
2424
<constraints>
25-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
25+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
2626
</constraints>
2727
</vspacer>
2828
<component id="ff9a4" class="com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox" binding="subscriptionComboBox">
@@ -35,7 +35,6 @@
3535
<constraints>
3636
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
3737
</constraints>
38-
<properties/>
3938
</component>
4039
<component id="62d7" class="javax.swing.JLabel">
4140
<constraints>
@@ -49,12 +48,6 @@
4948
<text value="Insights:"/>
5049
</properties>
5150
</component>
52-
<component id="cf801" class="com.intellij.ui.HyperlinkLabel" binding="lblCreate">
53-
<constraints>
54-
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
55-
</constraints>
56-
<properties/>
57-
</component>
5851
</children>
5952
</grid>
6053
</form>

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-applicationinsights/src/main/java/com/microsoft/azure/toolkit/intellij/applicationinsights/connection/ApplicationInsightsResourcePanel.java

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,17 @@
55

66
package com.microsoft.azure.toolkit.intellij.applicationinsights.connection;
77

8-
import com.intellij.ide.DataManager;
9-
import com.intellij.openapi.actionSystem.AnActionEvent;
10-
import com.intellij.openapi.actionSystem.DataContext;
11-
import com.intellij.openapi.actionSystem.Presentation;
12-
import com.intellij.openapi.ui.DialogWrapper;
13-
import com.intellij.ui.HyperlinkLabel;
14-
import com.microsoft.azure.toolkit.ide.common.action.ResourceCommonActionsContributor;
158
import com.microsoft.azure.toolkit.intellij.common.AzureComboBox;
169
import com.microsoft.azure.toolkit.intellij.common.AzureFormJPanel;
1710
import com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox;
1811
import com.microsoft.azure.toolkit.intellij.connector.Resource;
1912
import com.microsoft.azure.toolkit.lib.Azure;
2013
import com.microsoft.azure.toolkit.lib.applicationinsights.ApplicationInsight;
2114
import com.microsoft.azure.toolkit.lib.applicationinsights.AzureApplicationInsights;
22-
import com.microsoft.azure.toolkit.lib.common.action.AzureActionManager;
2315
import com.microsoft.azure.toolkit.lib.common.cache.CacheManager;
2416
import com.microsoft.azure.toolkit.lib.common.form.AzureFormInput;
2517
import com.microsoft.azure.toolkit.lib.common.form.AzureValidationInfo;
2618
import com.microsoft.azure.toolkit.lib.common.model.Subscription;
27-
import lombok.Getter;
2819
import org.apache.commons.lang3.StringUtils;
2920

3021
import javax.annotation.Nullable;
@@ -39,11 +30,9 @@
3930
import java.util.stream.Collectors;
4031

4132
public class ApplicationInsightsResourcePanel implements AzureFormJPanel<Resource<ApplicationInsight>> {
42-
@Getter
43-
private JPanel contentPanel;
33+
private JPanel pnlRoot;
4434
private SubscriptionComboBox subscriptionComboBox;
4535
private AzureComboBox<ApplicationInsight> insightComboBox;
46-
private HyperlinkLabel lblCreate;
4736

4837
public ApplicationInsightsResourcePanel() {
4938
this.init();
@@ -58,19 +47,6 @@ private void init() {
5847
this.insightComboBox.clear();
5948
}
6049
});
61-
62-
//noinspection DialogTitleCapitalization
63-
this.lblCreate.setHtmlText("<html><a href=\"\">Create new Application Insights</a> in Azure.</html>");
64-
this.lblCreate.addHyperlinkListener(e -> {
65-
final DataContext context = DataManager.getInstance().getDataContext(this.lblCreate);
66-
final AnActionEvent event = AnActionEvent.createFromInputEvent(e.getInputEvent(), "ApplicationInsightsResourcePanel", new Presentation(), context);
67-
final DialogWrapper dialog = DialogWrapper.findInstance(this.contentPanel);
68-
if (dialog != null) {
69-
dialog.close(DialogWrapper.CLOSE_EXIT_CODE);
70-
final AzureApplicationInsights service = Azure.az(AzureApplicationInsights.class);
71-
AzureActionManager.getInstance().getAction(ResourceCommonActionsContributor.CREATE).bind(service).handle(service, event);
72-
}
73-
});
7450
}
7551

7652
@Override
@@ -132,4 +108,9 @@ protected void refreshItems() {
132108
}
133109
};
134110
}
111+
112+
@Override
113+
public JPanel getContentPanel() {
114+
return pnlRoot;
115+
}
135116
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-cognitiveservices/src/main/java/com/microsoft/azure/toolkit/intellij/cognitiveservices/CognitiveServicesStartupListener.java

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import com.intellij.openapi.project.Project;
44
import com.intellij.openapi.startup.ProjectActivity;
5+
import com.microsoft.azure.toolkit.ide.common.action.ResourceCommonActionsContributor;
56
import com.microsoft.azure.toolkit.ide.guidance.GuidanceViewManager;
6-
import com.microsoft.azure.toolkit.intellij.common.settings.IntellijStore;
7+
import com.microsoft.azure.toolkit.intellij.common.action.IntellijAzureActionManager;
78
import com.microsoft.azure.toolkit.lib.Azure;
89
import com.microsoft.azure.toolkit.lib.cognitiveservices.AzureCognitiveServices;
910
import com.microsoft.azure.toolkit.lib.cognitiveservices.CognitiveDeployment;
@@ -14,7 +15,6 @@
1415
import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager;
1516
import kotlin.Unit;
1617
import kotlin.coroutines.Continuation;
17-
import org.apache.commons.lang3.BooleanUtils;
1818

1919
import javax.annotation.Nonnull;
2020

@@ -25,26 +25,21 @@
2525
public class CognitiveServicesStartupListener implements ProjectActivity {
2626
@Override
2727
public Object execute(@Nonnull Project project, @Nonnull Continuation<? super Unit> continuation) {
28-
final String tryOpenAIId = TRY_OPENAI.getId();
29-
final String tryPlaygroundId = TRY_PLAYGROUND.getId();
30-
if (BooleanUtils.isNotTrue(IntellijStore.getInstance().getState().getSuppressedActions().get(tryOpenAIId))) {
28+
final AzureActionManager am = AzureActionManager.getInstance();
29+
if (!IntellijAzureActionManager.isSuppressed(TRY_OPENAI)) {
3130
final Action<Project> tryOpenAI = new Action<>(TRY_OPENAI)
3231
.withLabel("Try Azure OpenAI")
3332
.withHandler((_d, e) -> {
3433
GuidanceViewManager.getInstance().openCourseView(project, "hello-openai");
35-
IntellijStore.getInstance().getState().getSuppressedActions().put(tryOpenAIId, true);
34+
IntellijAzureActionManager.suppress(TRY_OPENAI);
3635
})
3736
.withAuthRequired(true);
38-
;
39-
final Action<Object> dismiss = new Action<>(Action.Id.of("user/common.never_show_again"))
40-
.withLabel("Don't show again")
41-
.withHandler((e) -> IntellijStore.getInstance().getState().getSuppressedActions().put(tryOpenAIId, true))
42-
.withAuthRequired(false);
37+
final Action<Action.Id<?>> suppress = am.getAction(ResourceCommonActionsContributor.SUPPRESS_ACTION).bind(TRY_OPENAI);
4338
final AzureString msg = AzureString.format("You can use Azure OpenAI to build your own \"%s\" or other models. " +
4439
"<a href='https://go.microsoft.com/fwlink/?linkid=2202896'>Learn more</a> about Azure OpenAI.", "Copilot");
45-
AzureMessager.getMessager().info(msg, "Azure OpenAI is supported!", tryOpenAI, dismiss);
40+
AzureMessager.getMessager().info(msg, "Azure OpenAI is supported!", tryOpenAI, suppress);
4641
}
47-
if (BooleanUtils.isNotTrue(IntellijStore.getInstance().getState().getSuppressedActions().get(tryPlaygroundId))) {
42+
if (!IntellijAzureActionManager.isSuppressed(TRY_PLAYGROUND)) {
4843
AzureEventBus.once("account.subscription_changed.account", (_a, _b) -> Azure.az(AzureCognitiveServices.class).list().stream()
4944
.flatMap(m -> m.accounts().list().stream())
5045
.flatMap(a -> a.deployments().list().stream())
@@ -56,17 +51,14 @@ public Object execute(@Nonnull Project project, @Nonnull Continuation<? super Un
5651
.withLabel("Open in AI Playground")
5752
.withSource(d)
5853
.withHandler((_d, e) -> {
59-
AzureActionManager.getInstance().getAction(OPEN_DEPLOYMENT_IN_PLAYGROUND).handle(d, e);
60-
IntellijStore.getInstance().getState().getSuppressedActions().put(tryPlaygroundId, true);
54+
am.getAction(OPEN_DEPLOYMENT_IN_PLAYGROUND).handle(d, e);
55+
IntellijAzureActionManager.suppress(TRY_PLAYGROUND);
6156
})
6257
.withAuthRequired(true);
63-
final Action<Object> dismiss = new Action<>(Action.Id.of("user/common.never_show_again"))
64-
.withLabel("Don't show again")
65-
.withHandler((e) -> IntellijStore.getInstance().getState().getSuppressedActions().put(tryPlaygroundId, true))
66-
.withAuthRequired(false);
58+
final Action<Action.Id<?>> suppress = am.getAction(ResourceCommonActionsContributor.SUPPRESS_ACTION).bind(TRY_PLAYGROUND);
6759
final AzureString msg = AzureString.format("GPT* model based deployment (%s) is detected in your Azure Cognitive Services account (%s). " +
6860
"You can try your own \"%s\" in AI playground.", d.getName(), d.getParent().getName(), "Copilot");
69-
AzureMessager.getMessager().info(msg, "GPT* model is detected!", tryPlayGround, dismiss);
61+
AzureMessager.getMessager().info(msg, "GPT* model is detected!", tryPlayGround, suppress);
7062
}));
7163
}
7264
return null;

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-cognitiveservices/src/main/java/com/microsoft/azure/toolkit/intellij/cognitiveservices/chatbox/ChatBox.form

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,6 @@
139139
<properties/>
140140
<border type="none"/>
141141
<children>
142-
<component id="17373" class="com.intellij.ui.components.JBTextArea" binding="promptInput">
143-
<constraints>
144-
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
145-
<minimum-size width="20" height="20"/>
146-
</grid>
147-
</constraints>
148-
<properties>
149-
<lineWrap value="true"/>
150-
<rows value="3"/>
151-
<toolTipText value="Type user query here. (Shift + Enter for new line, Enter to send)"/>
152-
<wrapStyleWord value="false"/>
153-
</properties>
154-
</component>
155142
<component id="58621" class="javax.swing.JLabel" binding="sendBtn">
156143
<constraints>
157144
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
@@ -161,6 +148,24 @@
161148
<toolTipText value="Send."/>
162149
</properties>
163150
</component>
151+
<scrollpane id="99b69">
152+
<constraints>
153+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
154+
</constraints>
155+
<properties/>
156+
<border type="none"/>
157+
<children>
158+
<component id="17373" class="com.intellij.ui.components.JBTextArea" binding="promptInput">
159+
<constraints/>
160+
<properties>
161+
<lineWrap value="true"/>
162+
<rows value="5"/>
163+
<toolTipText value="Type user query here. (Shift + Enter for new line, Enter to send)"/>
164+
<wrapStyleWord value="false"/>
165+
</properties>
166+
</component>
167+
</children>
168+
</scrollpane>
164169
</children>
165170
</grid>
166171
</children>

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-cosmos/src/main/java/com/microsoft/azure/toolkit/intellij/cosmos/connection/CosmosDatabaseResourcePanel.form

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.microsoft.azure.toolkit.intellij.cosmos.connection.CosmosDatabaseResourcePanel">
3-
<grid id="27dc6" binding="contentPanel" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="27dc6" binding="pnlRoot" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="500" height="174"/>
6+
<xy x="20" y="20" width="500" height="124"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
@@ -22,7 +22,7 @@
2222
</component>
2323
<vspacer id="9ce9e">
2424
<constraints>
25-
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
25+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
2626
</constraints>
2727
</vspacer>
2828
<component id="a08e1" class="com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox" binding="cbSubscription">
@@ -39,7 +39,7 @@
3939
</component>
4040
<component id="b6b8a" class="com.microsoft.azure.toolkit.intellij.cosmos.connection.CosmosDatabaseComboBox" binding="cbDatabase" custom-create="true">
4141
<constraints>
42-
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
42+
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
4343
</constraints>
4444
<properties/>
4545
</component>
@@ -57,7 +57,7 @@
5757
</component>
5858
<component id="a5455" class="javax.swing.JLabel">
5959
<constraints>
60-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
60+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false">
6161
<minimum-size width="100" height="24"/>
6262
<preferred-size width="100" height="24"/>
6363
<maximum-size width="100" height="24"/>
@@ -67,18 +67,6 @@
6767
<text value="Database:"/>
6868
</properties>
6969
</component>
70-
<component id="596c9" class="com.intellij.ui.HyperlinkLabel" binding="lblCreateAccount">
71-
<constraints>
72-
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
73-
</constraints>
74-
<properties/>
75-
</component>
76-
<component id="de857" class="com.intellij.ui.HyperlinkLabel" binding="lblCreateDatabase">
77-
<constraints>
78-
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
79-
</constraints>
80-
<properties/>
81-
</component>
8270
</children>
8371
</grid>
8472
</form>

0 commit comments

Comments
 (0)