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

fix(ui): no hyphen for "create job" action + nice icon (#14776) (cherry-pick #14777) #14802

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions assets/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8036,6 +8036,12 @@
"disabled": {
"type": "boolean"
},
"displayName": {
"type": "string"
},
"iconClass": {
"type": "string"
},
"name": {
"type": "string"
},
Expand Down
1,397 changes: 740 additions & 657 deletions pkg/apis/application/v1alpha1/generated.pb.go

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pkg/apis/application/v1alpha1/generated.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkg/apis/application/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions pkg/apis/application/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"time"
"unicode"

"github.com/argoproj/argo-cd/v2/util/env"
"github.com/argoproj/gitops-engine/pkg/health"
synccommon "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/robfig/cron/v3"
Expand All @@ -36,6 +35,8 @@ import (
"k8s.io/client-go/tools/clientcmd/api"
"sigs.k8s.io/yaml"

"github.com/argoproj/argo-cd/v2/util/env"

"github.com/argoproj/argo-cd/v2/common"
"github.com/argoproj/argo-cd/v2/util/collections"
"github.com/argoproj/argo-cd/v2/util/helm"
Expand Down Expand Up @@ -1942,9 +1943,11 @@ type ResourceActionDefinition struct {
// TODO: describe this type
// TODO: describe members of this type
type ResourceAction struct {
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
Params []ResourceActionParam `json:"params,omitempty" protobuf:"bytes,2,rep,name=params"`
Disabled bool `json:"disabled,omitempty" protobuf:"varint,3,opt,name=disabled"`
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
Params []ResourceActionParam `json:"params,omitempty" protobuf:"bytes,2,rep,name=params"`
Disabled bool `json:"disabled,omitempty" protobuf:"varint,3,opt,name=disabled"`
IconClass string `json:"iconClass,omitempty" protobuf:"bytes,4,opt,name=iconClass"`
DisplayName string `json:"displayName,omitempty" protobuf:"bytes,5,opt,name=displayName"`
}

// TODO: describe this type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
actions = {}
actions["create-workflow"] = {}
actions["create-workflow"] = {
["iconClass"] = "fa fa-fw fa-play",
["displayName"] = "Create Workflow"
}
return actions
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
actions = {}
actions["create-workflow"] = {}
actions["create-workflow"] = {
["iconClass"] = "fa fa-fw fa-play",
["displayName"] = "Create Workflow"
}
return actions
5 changes: 4 additions & 1 deletion resource_customizations/batch/CronJob/actions/discovery.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
actions = {}
actions["create-job"] = {}
actions["create-job"] = {
["iconClass"] = "fa fa-fw fa-play",
["displayName"] = "Create Job"
}
return actions
15 changes: 8 additions & 7 deletions ui/src/app/applications/components/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,9 @@ function getResourceActionsMenuItems(resource: ResourceTreeNode, metadata: model
return actions.map(
action =>
({
title: action.name,
title: action.displayName ?? action.name,
disabled: !!action.disabled,
iconClassName: action.iconClass,
action: async () => {
try {
const confirmed = await apis.popup.confirm(`Execute '${action.name}' action?`, `Are you sure you want to execute '${action.name}' action?`);
Expand Down Expand Up @@ -436,14 +437,14 @@ function getActionItems(
...((isRoot && [
{
title: 'Sync',
iconClassName: 'fa fa-sync',
iconClassName: 'fa fa-fw fa-sync',
action: () => showDeploy(nodeKey(resource), null, apis)
}
]) ||
[]),
{
title: 'Delete',
iconClassName: 'fa fa-times-circle',
iconClassName: 'fa fa-fw fa-times-circle',
action: async () => {
return deletePopup(apis, resource, application, appChanged);
}
Expand All @@ -452,15 +453,15 @@ function getActionItems(
if (!isQuickStart) {
items.unshift({
title: 'Details',
iconClassName: 'fa fa-info-circle',
iconClassName: 'fa fa-fw fa-info-circle',
action: () => apis.navigation.goto('.', {node: nodeKey(resource)})
});
}

if (findChildPod(resource, tree)) {
items.push({
title: 'Logs',
iconClassName: 'fa fa-align-left',
iconClassName: 'fa fa-fw fa-align-left',
action: () => apis.navigation.goto('.', {node: nodeKey(resource), tab: 'logs'}, {replace: true})
});
}
Expand All @@ -477,7 +478,7 @@ function getActionItems(
return [
{
title: 'Exec',
iconClassName: 'fa fa-terminal',
iconClassName: 'fa fa-fw fa-terminal',
action: async () => apis.navigation.goto('.', {node: nodeKey(resource), tab: 'exec'}, {replace: true})
} as MenuItem
];
Expand All @@ -495,7 +496,7 @@ function getActionItems(
link =>
({
title: link.title,
iconClassName: `fa ${link.iconClass ? link.iconClass : 'fa-external-link'}`,
iconClassName: `fa fa-fw ${link.iconClass ? link.iconClass : 'fa-external-link'}`,
action: () => window.open(link.url, '_blank'),
tooltip: link.description
} as MenuItem)
Expand Down
2 changes: 2 additions & 0 deletions ui/src/app/shared/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ export interface ResourceAction {
name: string;
params: ResourceActionParam[];
disabled: boolean;
iconClass: string;
displayName: string;
}

export interface SyncWindowsState {
Expand Down