Skip to content

Commit

Permalink
Merge ff2e7ce into a26dea6
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswk committed Jan 13, 2021
2 parents a26dea6 + ff2e7ce commit bd55392
Show file tree
Hide file tree
Showing 32 changed files with 7,797 additions and 5,820 deletions.
66 changes: 60 additions & 6 deletions docs/api/admin/feature-toggles-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ This endpoint is the one all admin ui should use to fetch all available feature
"name": "variant2",
"weight": 50
}
],
"tags": [
{
"id": 1,
"type": "simple",
"value": "TeamRed"
}
]
},
{
Expand All @@ -59,7 +66,8 @@ This endpoint is the one all admin ui should use to fetch all available feature
}
}
],
"variants": []
"variants": [],
"tags": []
}
]
}
Expand All @@ -82,7 +90,8 @@ Used to fetch details about a specific featureToggle. This is mostly provded to
"parameters": {}
}
],
"variants": []
"variants": [],
"tags": []
}
```

Expand Down Expand Up @@ -144,6 +153,46 @@ Used by the admin dashboard to update a feature toggles. The name has to match a

Returns 200-respose if the feature toggle was updated successfully.

### Tag a Feature Toggle

`POST https://unleash.host.com/api/admin/features/:featureName/tags`

Used to tag a feature

If the tuple (type, value) does not already exist, it will be added to the list of tags. Then Unleash will add a relation between the feature name and the tagId

**Body:**

```json
{
"type": "simple",
"value": "Team-Green"
}
```

## Success

- Returns _201-CREATED_ if the feature was tagged successfully
- Creates the tag if needed, then connects the tag to the existing feature

## Failures

- Returns _404-NOT-FOUND_ if the `type` was not found

### Remove a tag from a Feature Toggle

`DELETE https://unleash.host.com/api/admin/features/:featureName/tags/:tagId`

Removes the specified tag from the Feature Toggle's list of tags, if the specified tagId does not exist, the operation is a noop.

## Success

- Returns _200-OK_

## Failures

- Returns 500 if the database could not be reached

### Archive a Feature Toggle

`DELETE: http://unleash.host.com/api/admin/features/:toggleName`
Expand Down Expand Up @@ -174,7 +223,8 @@ None
"parameters": {}
}
],
"variants": []
"variants": [],
"tags": []
}
```

Expand Down Expand Up @@ -203,7 +253,8 @@ None
"parameters": {}
}
],
"variants": []
"variants": [],
"tags": []
}
```

Expand Down Expand Up @@ -232,7 +283,8 @@ None
"parameters": {}
}
],
"variants": []
"variants": [],
"tags": []
}
```

Expand Down Expand Up @@ -261,7 +313,8 @@ None
"parameters": {}
}
],
"variants": []
"variants": [],
"tags": []
}
```

Expand Down Expand Up @@ -292,6 +345,7 @@ Used to fetch list of archived feature toggles
}
],
"variants": [],
"tags": [],
"strategy": "default",
"parameters": {}
}
Expand Down
174 changes: 174 additions & 0 deletions docs/api/admin/tags-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
id: tags
title: /api/admin/tags
---

> In order to access the admin API endpoints you need to identify yourself. If you are using the `insecure` authentication method, you may use [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication) to identify yourself.
### Create a new tag

`POST https://unleash.host.com/api/admin/tags`

Creates a new tag without connecting it to any other object, can be helpful to build an autocomplete list.

**Body**

```json
{
"value": "MyTag",
"type": "simple"
}
```

### Notes

- `type` must exist in tag-types

### List tags

`GET https://unleash.host.com/api/admin/tags`

This endpoint is the one all admin UIs should use to fetch all available tags from the _unleash_server_. The response returns all tags.

**Example response:**

```json
{
"version": 1,
"tags": [
{
"id": 5,
"value": "Team-Red",
"type": "simple"
},
{
"id": 9,
"value": "Team-Green",
"type": "simple"
},
{
"id": 19,
"value": "DecemberExperiment",
"type": "simple"
},
{
"id": 25,
"value": "#team-alert-channel",
"type": "slack"
}
]
}
```

### List tags by type

`GET: https://unleash.host.com/api/admin/tags/:type`

Lists all tags of `:type`. If none exist, returns the empty list

**Example response to query for https://unleash.host.com/api/admin/tags/simple**

```json
{
"version": 1,
"tags": [
{
"id": 5,
"value": "Team-Red",
"type": "simple"
},
{
"id": 9,
"value": "Team-Green",
"type": "simple"
},
{
"id": 19,
"value": "DecemberExperiment",
"type": "simple"
}
]
}
```

### Fetching Tag types

`GET: https://unleash.host.com/api/admin/tag-types`

Used to fetch all types the server knows about. This endpoint is the one all admin UI should use to fetch all available tag types from the _unleash-server_. The response returns all tag types. Any server will have _at least_ one configured tag type (the `simple` type). A tag type will be a map of `type`, `description`, `icon`

**Example response:**

```json
{
"version": 1,
"tagTypes": [
{
"name": "simple",
"description": "Arbitrary tags. Used to simplify filtering of features",
"icon": "#"
}
]
}
```

### Get a single tag type

`GET: https://unleash.host.com/api/admin/tag-types/simple`

Used to fetch details about a specific tag-type. This is mostly provded to make it easy to debug the API and should not be used by the client implementations.

**Example response:**

```json
{
"version": 1,
"tagType": {
"name": "simple",
"description": "Some description",
"icon": "Some icon",
"createdAt": "2021-01-07T10:00:00Z"
}
}
```

### Create a new tag type

`POST: https://unleash.host.com/api/admin/tag-types`

Used to register a new tag type. This endpoint should be used to inform the server about a new type of tags.

**Body:**

```json
{
"name": "tagtype",
"description": "Purpose of tag type",
"icon": "Either an URL to icon or a simple prefix string for tag"
}
```

**Notes:**

- if `name` is not unique, will return 409 CONFLICT, if you'd like to update an existing tag through admin-api look at [Update tag type](#Update-tag-type).

Returns 201-CREATED if the tag type was created successfully

### Update tag type

`PUT: https://unleash.host.com/api/admin/tag-types/:typeName`

**Body:**

```json
{
"description": "New description",
"icon": "New icon"
}
```

### Deleting a tag type

`DELETE: https://unleash.host.com/api/admin/tag-types/:typeName`

Returns 200 if the type was not in use and the type was deleted. If the type was in use, will return a _409 CONFLICT_
26 changes: 26 additions & 0 deletions docs/tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
id: tags
title: Tagging Features
---

> This feature was introduced in Unleash vx.y.z
Do you want to filter your features to avoid having to see all features belonging to other teams than your own? Do you want to write a plugin that only gets notified about changes to features that your plugin knows how to handle?

### Say hello to Typed tags

Unleash supports tagging features with an arbitrary number of tags. This eases filtering the list of tags to only those features that are tagged with the tag you're interested in.

#### How does it work?

Unleash will allow users to tag any feature with any number of tags. When viewing a feature, the UI will/may display all tags connected to that feature.

When adding a new tag, a dropdown will show you which type of tag you're about to add. Our first type; `simple` are meant to be used for filtering features. Show only features that have a tag of `MyTeam`.

#### Tag types

Types can be anything, and their purpose is to add some semantics to the tag itself.

Some tag types will be defined by plugins (e.g. the slack plugin can define the slack-type, to make it easy to specify which slack channels to post updates for a specific feature toggle to).

Other tags can be defined by the user to give semantic logic to the management of the UI. It could be that you want to use tag functionality to specify which products a feature toggle belongs to, or to which teams.
9 changes: 9 additions & 0 deletions lib/command-type.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
TAG_FEATURE: 'tag-feature',
UNTAG_FEATURE: 'untag-feature',
CREATE_TAG: 'create-tag',
DELETE_TAG: 'delete-tag',
CREATE_TAG_TYPE: 'create-tag-type',
DELETE_TAG_TYPE: 'delete-tag-type',
UPDATE_TAG_TYPE: 'update-tag-type',
};

0 comments on commit bd55392

Please sign in to comment.