On Mon, Sep 28, 2020 at 07:40:10PM +0800, Wu Fengguang wrote:
Let's concentrate all the tbox_group manipulation logics into a central lib.
On Mon, Sep 28, 2020 at 03:49:19PM +0800, Zhang Yuhang wrote:
change to remove /-(\d+)$/
Exmaple: "taishan-xxx--xxx-12" remove "-12"
Signed-off-by: Zhang Yuhang zhangyuhang25@huawei.com
src/lib/web_backend.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/lib/web_backend.rb b/src/lib/web_backend.rb index 4544690..419ef86 100644 --- a/src/lib/web_backend.rb +++ b/src/lib/web_backend.rb @@ -41,16 +41,19 @@ def es_count(query) ES_CLIENT.count(index: 'jobs*', body: query)['count'] end
These comments are essential, however not enough. What's the reason or purpose for all these rules?
-# "vm-hi1620-2p8g-212" remove "-212" -# "vm-hi1620-2p8g-zzz" remove "-zzz" -# "vm-git-bisect" don't remove "-bisect" +# vm-hi1620-2p4g-12 remove -12 +# taishan-xxx--xxx-12 remove -12 +# vm-hi1620-2p4g--0x remove --0x +# vm-hi1620-2p4g-abc remove -abc +# vm-git-bisect don't remove -bisect
Thanks, Fengguang
# string =~ regex # # 1. "-(\d+)$" # - description: if string last "-" char end with pure number, remove "-numbers" # - example: "xxx-xxx--xxx-12" remove "-12" # # 2. "--.+$" # - description: if string include "--" chars, remove "--chars" # - exmaple: "xxx-xxx--xxx" remove "--xxx" # # 3. "-\d\w*-[a-zA-Z]+$" # - description: if the word before string last "-" char start with a number and # the word after that "-" char is pure letter, remove "-letters" # - example: "xxx-2xx-abc" remove "-abc", "xxx-axx-abc", don't remove "-abc"
Would it be all right?
Thanks, Zhang Yuhang