Skip to content

Commit

Permalink
Show rocks versions in webui (#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson authored Aug 23, 2024
1 parent f485e17 commit 24c7737
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
13 changes: 13 additions & 0 deletions cartridge/lua-api/boxinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ local function set_webui_prefix(prefix)
vars.webui_prefix = prefix
end

local rocks_cache = {}

--- Retrieve `box.cfg` and `box.info` of a remote server.
-- @function get_info
-- @local
Expand Down Expand Up @@ -126,6 +128,16 @@ local function get_info(uri)
listen = box_cfg.listen.uri or box_cfg.listen[1].uri
end

if next(rocks_cache) == nil then
local rocks = box.internal.feedback_daemon:generate_feedback().rocks
rocks.cartridge = nil
rocks.ddl = nil
rocks.vshard = nil
for rock_name, rock_version in pairs(rocks) do
table.insert(rocks_cache, ("%s == %s"):format(rock_name, rock_version))
end
end

local ret = {
general = {
version = (package and (package .. ' ') or '') .. box_info.version,
Expand Down Expand Up @@ -197,6 +209,7 @@ local function get_info(uri)
version = require('cartridge').VERSION,
vshard_version = vshard_version,
ddl_version = ddl_version,
rocks = rocks_cache,
state = server_state,
error = server_error,
},
Expand Down
4 changes: 4 additions & 0 deletions cartridge/webui/gql-boxinfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ local boxinfo_schema = {
kind = gql_types.string,
description = 'DDL version',
},
rocks = {
kind = gql_types.list(gql_types.string),
description = 'List of rocks and their versions',
},
}
}).nonNull,
membership = gql_types.object({
Expand Down
5 changes: 4 additions & 1 deletion doc/schema.graphql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# source: http://127.0.0.1:8081/admin/api
# timestamp: Wed May 15 2024 19:16:51 GMT+0300 (Moscow Standard Time)
# timestamp: Thu Aug 22 2024 19:23:56 GMT+0300 (Moscow Standard Time)

"""Custom scalar specification."""
directive @specifiedBy(
Expand Down Expand Up @@ -739,6 +739,9 @@ type ServerInfoCartridge {

"""DDL version"""
ddl_version: String

"""List of rocks and their versions"""
rocks: [String]
}

type ServerInfoGeneral {
Expand Down
8 changes: 5 additions & 3 deletions webui/src/generated/graphql-typing-flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ export type ServerInfoCartridge = {|
vshard_version?: $ElementType<Scalars, 'String'>,
/** DDL version */
ddl_version?: $ElementType<Scalars, 'String'>,
/** Rocks Versions */
rocks?: ?Array<?$ElementType<Scalars, 'String'>>,
|};

export type ServerInfoGeneral = {|
Expand Down Expand Up @@ -1065,7 +1067,7 @@ export type ServerDetailsFieldsFragment = ({
...{ __typename?: 'ServerInfo' },
...{| cartridge: ({
...{ __typename?: 'ServerInfoCartridge' },
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: *, ddl_version?: * |}>
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: *, ddl_version?: * , rocks?: * |}>
}), membership: ({
...{ __typename?: 'ServerInfoMembership' },
...$Pick<ServerInfoMembership, {| status?: *, incarnation?: *, PROTOCOL_PERIOD_SECONDS?: *, ACK_TIMEOUT_SECONDS?: *, ANTI_ENTROPY_PERIOD_SECONDS?: *, SUSPECT_TIMEOUT_SECONDS?: *, NUM_FAILURE_DETECTION_SUBGROUPS?: * |}>
Expand Down Expand Up @@ -1122,7 +1124,7 @@ export type InstanceDataQuery = ({
...{ __typename?: 'ServerInfo' },
...{| cartridge: ({
...{ __typename?: 'ServerInfoCartridge' },
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: *, ddl_version?: * |}>
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: *, ddl_version?: *, rocks?: * |}>
}), membership: ({
...{ __typename?: 'ServerInfoMembership' },
...$Pick<ServerInfoMembership, {| status?: *, incarnation?: *, PROTOCOL_PERIOD_SECONDS?: *, ACK_TIMEOUT_SECONDS?: *, ANTI_ENTROPY_PERIOD_SECONDS?: *, SUSPECT_TIMEOUT_SECONDS?: *, NUM_FAILURE_DETECTION_SUBGROUPS?: * |}>
Expand Down Expand Up @@ -1228,7 +1230,7 @@ export type BoxInfoQuery = ({
...{ __typename?: 'ServerInfo' },
...{| cartridge: ({
...{ __typename?: 'ServerInfoCartridge' },
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: *, ddl_version?: * |}>
...$Pick<ServerInfoCartridge, {| version: *, vshard_version?: *, ddl_version?: *, rocks?: * |}>
}), membership: ({
...{ __typename?: 'ServerInfoMembership' },
...$Pick<ServerInfoMembership, {| status?: *, incarnation?: *, PROTOCOL_PERIOD_SECONDS?: *, ACK_TIMEOUT_SECONDS?: *, ANTI_ENTROPY_PERIOD_SECONDS?: *, SUSPECT_TIMEOUT_SECONDS?: *, NUM_FAILURE_DETECTION_SUBGROUPS?: * |}>
Expand Down
5 changes: 5 additions & 0 deletions webui/src/generated/graphql-typing-ts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,8 @@ export type ServerInfoCartridge = {
vshard_version?: Maybe<Scalars['String']>;
/** DDL version */
ddl_version?: Maybe<Scalars['String']>;
/** Rocks versions */
rocks?: Maybe<Array<Maybe<Scalars['String']>>>;
};

export type ServerInfoGeneral = {
Expand Down Expand Up @@ -1177,6 +1179,7 @@ export type ServerDetailsFieldsFragment = {
version: string;
vshard_version: string | null;
ddl_version: string | null;
rocks: Array<string | null> | null;
};
membership: {
__typename?: 'ServerInfoMembership';
Expand Down Expand Up @@ -1310,6 +1313,7 @@ export type InstanceDataQuery = {
version: string;
vshard_version: string | null;
ddl_version: string | null;
rocks: Array<string | null> | null;
};
membership: {
__typename?: 'ServerInfoMembership';
Expand Down Expand Up @@ -1476,6 +1480,7 @@ export type BoxInfoQuery = {
version: string;
vshard_version: string | null;
ddl_version: string | null;
rocks: Array<string | null> | null;
};
membership: {
__typename?: 'ServerInfoMembership';
Expand Down
1 change: 1 addition & 0 deletions webui/src/store/request/queries.graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const serverDetailsFields = gql`
version
vshard_version
ddl_version
rocks
}
membership {
status
Expand Down

0 comments on commit 24c7737

Please sign in to comment.