Class: Graphql::Dashboard::OperationStore::ClientsController
Instance Method Summary
collapse
#check_installed, #feature_installed?
#schema_class
Instance Method Details
#create ⇒ Object
40
41
42
43
44
45
|
# File 'lib/graphql/dashboard/operation_store.rb', line 40
def create
client_params = params.require(:client).permit(:name, :secret)
schema_class.operation_store.upsert_client(client_params[:name], client_params[:secret])
flash[:success] = "Created #{client_params[:name].inspect}"
redirect_to graphql_dashboard.operation_store_clients_path
end
|
#destroy ⇒ Object
59
60
61
62
63
64
|
# File 'lib/graphql/dashboard/operation_store.rb', line 59
def destroy
client_name = params[:name]
schema_class.operation_store.delete_client(client_name)
flash[:success] = "Deleted #{client_name.inspect}"
redirect_to graphql_dashboard.operation_store_clients_path
end
|
#edit ⇒ Object
47
48
49
|
# File 'lib/graphql/dashboard/operation_store.rb', line 47
def edit
@client = schema_class.operation_store.get_client(params[:name])
end
|
#index ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/graphql/dashboard/operation_store.rb', line 23
def index
@order_by = params[:order_by] || "name"
@order_dir = params[:order_dir].presence || "asc"
clients_page = schema_class.operation_store.all_clients(
page: params[:page]&.to_i || 1,
per_page: params[:per_page]&.to_i || 25,
order_by: @order_by,
order_dir: @order_dir,
)
@clients_page = clients_page
end
|
#new ⇒ Object
36
37
38
|
# File 'lib/graphql/dashboard/operation_store.rb', line 36
def new
@client = init_client(secret: SecureRandom.hex(32))
end
|
#update ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/graphql/dashboard/operation_store.rb', line 51
def update
client_name = params[:name]
client_secret = params.require(:client).permit(:secret)[:secret]
schema_class.operation_store.upsert_client(client_name, client_secret)
flash[:success] = "Updated #{client_name.inspect}"
redirect_to graphql_dashboard.operation_store_clients_path
end
|